From f54817d78d1281b45ccb5fd1036b377eebe29ce5 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 31 Oct 2024 11:37:28 -0700 Subject: [PATCH] groups: Enable group-valued settings in production. --- zerver/models/realms.py | 24 ++++++++++++------------ zproject/default_settings.py | 6 ------ zproject/dev_settings.py | 3 --- zproject/test_extra_settings.py | 2 -- 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/zerver/models/realms.py b/zerver/models/realms.py index 9b5a0fc4d8..8a6ac401ed 100644 --- a/zerver/models/realms.py +++ b/zerver/models/realms.py @@ -672,7 +672,7 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub REALM_PERMISSION_GROUP_SETTINGS: dict[str, GroupPermissionSetting] = dict( create_multiuse_invite_group=GroupPermissionSetting( - require_system_group=not settings.ALLOW_GROUP_VALUED_SETTINGS, + require_system_group=False, allow_internet_group=False, allow_owners_group=False, allow_nobody_group=True, @@ -691,7 +691,7 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub allowed_system_groups=[SystemGroups.EVERYONE, SystemGroups.MEMBERS], ), can_add_custom_emoji_group=GroupPermissionSetting( - require_system_group=not settings.ALLOW_GROUP_VALUED_SETTINGS, + require_system_group=False, allow_internet_group=False, allow_owners_group=False, allow_nobody_group=False, @@ -700,7 +700,7 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub id_field_name="can_add_custom_emoji_group_id", ), can_create_groups=GroupPermissionSetting( - require_system_group=not settings.ALLOW_GROUP_VALUED_SETTINGS, + require_system_group=False, allow_internet_group=False, allow_owners_group=True, allow_nobody_group=False, @@ -709,7 +709,7 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub id_field_name="can_create_groups_id", ), can_create_public_channel_group=GroupPermissionSetting( - require_system_group=not settings.ALLOW_GROUP_VALUED_SETTINGS, + require_system_group=False, allow_internet_group=False, allow_owners_group=False, allow_nobody_group=False, @@ -718,7 +718,7 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub id_field_name="can_create_public_channel_group_id", ), can_create_private_channel_group=GroupPermissionSetting( - require_system_group=not settings.ALLOW_GROUP_VALUED_SETTINGS, + require_system_group=False, allow_internet_group=False, allow_owners_group=False, allow_nobody_group=False, @@ -742,7 +742,7 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub ], ), can_delete_any_message_group=GroupPermissionSetting( - require_system_group=not settings.ALLOW_GROUP_VALUED_SETTINGS, + require_system_group=False, allow_internet_group=False, allow_owners_group=False, allow_nobody_group=False, @@ -751,7 +751,7 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub id_field_name="can_delete_any_message_group_id", ), can_delete_own_message_group=GroupPermissionSetting( - require_system_group=not settings.ALLOW_GROUP_VALUED_SETTINGS, + require_system_group=False, allow_internet_group=False, allow_owners_group=False, allow_nobody_group=False, @@ -760,7 +760,7 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub id_field_name="can_delete_own_message_group_id", ), can_manage_all_groups=GroupPermissionSetting( - require_system_group=not settings.ALLOW_GROUP_VALUED_SETTINGS, + require_system_group=False, allow_internet_group=False, allow_owners_group=True, allow_nobody_group=False, @@ -769,7 +769,7 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub id_field_name="can_manage_all_groups_id", ), can_move_messages_between_channels_group=GroupPermissionSetting( - require_system_group=not settings.ALLOW_GROUP_VALUED_SETTINGS, + require_system_group=False, allow_internet_group=False, allow_owners_group=False, allow_nobody_group=True, @@ -778,7 +778,7 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub id_field_name="can_move_messages_between_channels_group_id", ), can_move_messages_between_topics_group=GroupPermissionSetting( - require_system_group=not settings.ALLOW_GROUP_VALUED_SETTINGS, + require_system_group=False, allow_internet_group=False, allow_owners_group=False, allow_nobody_group=True, @@ -787,7 +787,7 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub id_field_name="can_move_messages_between_topics_group_id", ), direct_message_initiator_group=GroupPermissionSetting( - require_system_group=not settings.ALLOW_GROUP_VALUED_SETTINGS, + require_system_group=False, allow_internet_group=False, allow_owners_group=True, allow_nobody_group=True, @@ -796,7 +796,7 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub id_field_name="direct_message_initiator_group_id", ), direct_message_permission_group=GroupPermissionSetting( - require_system_group=not settings.ALLOW_GROUP_VALUED_SETTINGS, + require_system_group=False, allow_internet_group=False, allow_owners_group=True, allow_nobody_group=True, diff --git a/zproject/default_settings.py b/zproject/default_settings.py index b4c7f6b691..6b62e88541 100644 --- a/zproject/default_settings.py +++ b/zproject/default_settings.py @@ -667,12 +667,6 @@ SIGNED_ACCESS_TOKEN_VALIDITY_IN_SECONDS = 60 CUSTOM_AUTHENTICATION_WRAPPER_FUNCTION: Callable[..., Any] | None = None -# Whether we allow settings to be set to a collection of users and -# groups as described in api_docs/group-setting-values.md. Set to -# False in production, as we can only handle named user groups in the -# web app settings UI. -ALLOW_GROUP_VALUED_SETTINGS = False - # Grace period during which we don't send a resolve/unresolve # notification to a stream and also delete the previous counter # notification. diff --git a/zproject/dev_settings.py b/zproject/dev_settings.py index c7def46bdb..20f7807a38 100644 --- a/zproject/dev_settings.py +++ b/zproject/dev_settings.py @@ -211,9 +211,6 @@ ZULIP_SERVICES_URL = f"http://push.{EXTERNAL_HOST}" ZULIP_SERVICE_PUSH_NOTIFICATIONS = True ZULIP_SERVICE_SUBMIT_USAGE_STATISTICS = True -# Breaks the UI if used, but enabled for development environment testing. -ALLOW_GROUP_VALUED_SETTINGS = True - # This value needs to be lower in development than usual to allow # for quicker testing of the feature. RESOLVE_TOPIC_UNDO_GRACE_PERIOD_SECONDS = 5 diff --git a/zproject/test_extra_settings.py b/zproject/test_extra_settings.py index a2c600b09d..f0951ef364 100644 --- a/zproject/test_extra_settings.py +++ b/zproject/test_extra_settings.py @@ -281,8 +281,6 @@ SCIM_CONFIG: dict[str, SCIMConfigDict] = { } } -ALLOW_GROUP_VALUED_SETTINGS = True - # This override disables the grace period for undoing resolving/unresolving # a topic in tests. # This allows tests to not worry about the special behavior during the grace period.