mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
stream: Show private channel for their channel admins.
Fixes https://chat.zulip.org/#narrow/channel/101-design/topic/permissions.20for.20admin.20to.20unsubscribe.20others/near/2060197 Non realm admin users were not able to view private channels they were an administrator of but not subscribed to it. This commit changes that. We also made changes for those users to be able to see the subscribers list. The increase in query count in test_home and test_event_system can be mitigated by only fetching recursive user group ids when needed within the `validate_user_access_to_subscribers_helper` function. But that would require refactoring that function to handle multiple streams and subscriptions at once, along with changing how that function is used at different places, which might be an exercise better left as a follow up. We have optimised the code a little bit by not fetching the group ids in case the current user is a realm admin. We are fetching channel_admin_ids and users belonging to can_add_subscribers_group directly in stream_subscription.py without using the helper function `get_user_ids_with_metadata_access_via_permission_groups`. This is due to a cyclic dependency and we will move `bulk_get_subscriber_peer_info` to another file in the next commit.
This commit is contained in:
committed by
Tim Abbott
parent
48eec43f48
commit
aabf42c2ce
@@ -539,6 +539,17 @@ def access_stream_for_delete_or_update_requiring_metadata_access(
|
||||
return (stream, sub)
|
||||
|
||||
|
||||
def has_metadata_access_to_channel_via_groups(
|
||||
user_recursive_group_ids: set[int],
|
||||
can_administer_channel_group_id: int,
|
||||
can_add_subscribers_group_id: int,
|
||||
) -> bool:
|
||||
return (
|
||||
can_administer_channel_group_id in user_recursive_group_ids
|
||||
or can_add_subscribers_group_id in user_recursive_group_ids
|
||||
)
|
||||
|
||||
|
||||
def check_basic_stream_access(
|
||||
user_profile: UserProfile,
|
||||
stream: Stream,
|
||||
|
||||
Reference in New Issue
Block a user