realm: Default can_create_groups to moderators for education realms.

This commit is contained in:
Shubham Padia 2024-09-17 10:28:33 +00:00 committed by Tim Abbott
parent d7d03628d0
commit 4a1b67804f
2 changed files with 15 additions and 1 deletions

View File

@ -295,7 +295,11 @@ def do_create_realm(
"can_create_public_channel_group": {
Realm.ORG_TYPES["education_nonprofit"]["id"]: SystemGroups.ADMINISTRATORS,
Realm.ORG_TYPES["education"]["id"]: SystemGroups.ADMINISTRATORS,
}
},
"can_create_groups": {
Realm.ORG_TYPES["education_nonprofit"]["id"]: SystemGroups.MODERATORS,
Realm.ORG_TYPES["education"]["id"]: SystemGroups.MODERATORS,
},
}
set_default_for_realm_permission_group_settings(
realm, group_settings_defaults_for_org_types

View File

@ -125,6 +125,11 @@ class RealmTest(ZulipTestCase):
)
self.assertEqual(realm.user_group_edit_policy, CommonPolicyEnum.MODERATORS_ONLY)
self.assertEqual(realm.invite_to_stream_policy, CommonPolicyEnum.MODERATORS_ONLY)
realm = get_realm("test_education_non_profit")
moderators_group = NamedUserGroup.objects.get(
name=SystemGroups.MODERATORS, realm=realm, is_system_group=True
)
self.assertEqual(realm.can_create_groups.id, moderators_group.id)
def test_permission_for_education_for_profit_organization(self) -> None:
realm = do_create_realm(
@ -145,6 +150,11 @@ class RealmTest(ZulipTestCase):
)
self.assertEqual(realm.user_group_edit_policy, CommonPolicyEnum.MODERATORS_ONLY)
self.assertEqual(realm.invite_to_stream_policy, CommonPolicyEnum.MODERATORS_ONLY)
realm = get_realm("test_education_for_profit")
moderators_group = NamedUserGroup.objects.get(
name=SystemGroups.MODERATORS, realm=realm, is_system_group=True
)
self.assertEqual(realm.can_create_groups.id, moderators_group.id)
def test_realm_enable_spectator_access(self) -> None:
realm = do_create_realm(