mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
realm owner: Make first user as realm owner on realm creation.
This commit sets the role of the user creating the realm as realm owner after the realm is created. Previously, the role of user creating the realm was set as admin. But now we want it to be owner because owners have the highest privilege level.
This commit is contained in:
@@ -37,7 +37,9 @@ def get_display_email_address(user_profile: UserProfile, realm: Realm) -> str:
|
||||
return user_profile.delivery_email
|
||||
|
||||
def get_role_for_new_user(invited_as: int, realm_creation: bool=False) -> int:
|
||||
if invited_as == PreregistrationUser.INVITE_AS['REALM_ADMIN'] or realm_creation:
|
||||
if realm_creation:
|
||||
return UserProfile.ROLE_REALM_OWNER
|
||||
elif invited_as == PreregistrationUser.INVITE_AS['REALM_ADMIN']:
|
||||
return UserProfile.ROLE_REALM_ADMINISTRATOR
|
||||
elif invited_as == PreregistrationUser.INVITE_AS['GUEST_USER']:
|
||||
return UserProfile.ROLE_GUEST
|
||||
|
||||
@@ -2177,8 +2177,8 @@ class RealmCreationTest(ZulipTestCase):
|
||||
user = get_user(email, realm)
|
||||
self.assertEqual(user.realm, realm)
|
||||
|
||||
# Check that user is the administrator.
|
||||
self.assertEqual(user.role, UserProfile.ROLE_REALM_ADMINISTRATOR)
|
||||
# Check that user is the owner.
|
||||
self.assertEqual(user.role, UserProfile.ROLE_REALM_OWNER)
|
||||
|
||||
# Check defaults
|
||||
self.assertEqual(realm.org_type, Realm.CORPORATE)
|
||||
|
||||
Reference in New Issue
Block a user