dev_login: Move owners to the top.

Since owners have the highest privilege level, it made little sense to
sandwich them between administrators and guests.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-06-07 17:28:51 -07:00 committed by Tim Abbott
parent 6dc24d303e
commit b1b34b6f6a
2 changed files with 10 additions and 10 deletions

View File

@ -19,15 +19,6 @@ page can be easily identified in it's respective JavaScript file -->
<div class="control-group">
<div class="controls">
<div class="group">
<h2>{{ _('Administrators') }}</h2>
{% if direct_admins %}
{% for direct_admin in direct_admins %}
<p><input type="submit" formaction="{{ direct_admin.realm.uri }}{{ url('zerver.views.auth.dev_direct_login') }}"
name="direct_email" class="btn-direct btn-admin" value="{{ direct_admin.delivery_email }}" /></p>
{% endfor %}
{% else %}
<p>No administrators found in this realm</p>
{% endif %}
<h2>{{_('Owners') }}</h2>
{% if direct_owners %}
{% for direct_owner in direct_owners %}
@ -37,6 +28,15 @@ page can be easily identified in it's respective JavaScript file -->
{% else %}
<p>No owners found in this realm</p>
{% endif %}
<h2>{{ _('Administrators') }}</h2>
{% if direct_admins %}
{% for direct_admin in direct_admins %}
<p><input type="submit" formaction="{{ direct_admin.realm.uri }}{{ url('zerver.views.auth.dev_direct_login') }}"
name="direct_email" class="btn-direct btn-admin" value="{{ direct_admin.delivery_email }}" /></p>
{% endfor %}
{% else %}
<p>No administrators found in this realm</p>
{% endif %}
<h2>{{ _('Guest users') }}</h2>
{% if guest_users %}
{% for guest_user in guest_users %}

View File

@ -600,8 +600,8 @@ def add_dev_login_context(realm: Optional[Realm], context: Dict[str, Any]) -> No
def sort(lst: List[UserProfile]) -> List[UserProfile]:
return sorted(lst, key=lambda u: u.delivery_email)
context['direct_admins'] = sort([u for u in users if u.is_realm_admin and not u.is_realm_owner])
context['direct_owners'] = sort([u for u in users if u.is_realm_owner])
context['direct_admins'] = sort([u for u in users if u.is_realm_admin and not u.is_realm_owner])
context['guest_users'] = sort([u for u in users if u.is_guest])
context['direct_users'] = sort([u for u in users if not (u.is_realm_admin or u.is_guest)])