mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
Cleanup guardian-based complexity in get_realm_user_dicts.
The old code for this lookup was unnecessarily complicated because we were working around Guardian, where the `is_realm_admin` check was extremely expensive.
This commit is contained in:
@@ -2426,11 +2426,8 @@ def get_status_dict(requesting_user_profile):
|
||||
|
||||
|
||||
def get_realm_user_dicts(user_profile):
|
||||
# Due to our permission model, it is advantageous to find the admin users in bulk.
|
||||
admins = user_profile.realm.get_admin_users()
|
||||
admin_emails = set([up.email for up in admins])
|
||||
return [{'email' : userdict['email'],
|
||||
'is_admin' : userdict['email'] in admin_emails,
|
||||
'is_admin' : userdict['is_realm_admin'],
|
||||
'is_bot' : userdict['is_bot'],
|
||||
'full_name' : userdict['full_name']}
|
||||
for userdict in get_active_user_dicts_in_realm(user_profile.realm)]
|
||||
|
||||
Reference in New Issue
Block a user