streams: Refactor code to set group-based stream settings.

We add stream_permission_group_settings object which is
similar to property_types framework used for realm settings.

This commit also adds GroupPermissionSetting dataclass for
defining settings inside stream_permission_group_settings.

We add "do_change_stream_group_based_setting" function which
is called in loop to update all the group-based stream settings
and it is now used to update 'can_remove_subscribers_group'
setting instead of "do_change_can_remove_subscribers_group".

We also change the variable name for event_type field of
RealmAuditLog objects to STREAM_GROUP_BASED_SETTING_CHANGED
since this will be used for all group-based stream settings.

'property' field is also added to extra_data field to identify
the setting for which RealmAuditLog object was created.

We will add a migration in further commits which will add the
property field to existing RealmAuditLog objects created for
changing can_remove_subscribers_group setting.
This commit is contained in:
Sahil Batra
2023-02-17 17:16:14 +05:30
committed by Tim Abbott
parent 416c7c2199
commit 0cf99cf5c3
6 changed files with 66 additions and 25 deletions

View File

@@ -272,3 +272,10 @@ class RealmPlaygroundDict(TypedDict):
name: str
pygments_language: str
url_prefix: str
@dataclass
class GroupPermissionSetting:
require_system_group: bool
allow_internet_group: bool
allow_owners_group: bool