Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
stream: User with just can add permissions should be able to add.
Shubham Padia0f51b029a0f0
diff --git a/api_docs/changelog.md b/api_docs/changelog.mdindex 8db0118b9fa..8c327963c4c 100644--- a/api_docs/changelog.md+++ b/api_docs/changelog.md@@ -20,6 +20,12 @@ format used by the Zulip server that they are interacting with.## Changes in Zulip 10.0+**Feature level 349**++* [`POST /users/me/subscriptions`](/api/subscribe): Users belonging to+ `can_add_subscribers_group` should be able to add subscribers to a+ private channel without being subscribed to it.+**Feature level 348*** [`POST /register`](/api/register-queue), [`POST /events`](/api/get-events),diff --git a/version.py b/version.pyindex 1eaa91ddd9d..add373ccea7 100644--- a/version.py+++ b/version.py@@ -34,7 +34,7 @@ DESKTOP_WARNING_VERSION = "5.9.3"# new level means in api_docs/changelog.md, as well as "**Changes**"# entries in the endpoint's documentation in `zulip.yaml`.-API_FEATURE_LEVEL = 348 # Last bumped for enable_guest_user_dm_warning.+API_FEATURE_LEVEL = 349 # Last bumped for taking into account stream metadata access permissions.# Bump the minor PROVISION_VERSION to indicate that folks should provision# only when going from an old version of the code to a newer version. Bumpdiff --git a/zerver/lib/streams.py b/zerver/lib/streams.pyindex 4ac3a3f675a..ad720ebe966 100644--- a/zerver/lib/streams.py+++ b/zerver/lib/streams.py@@ -904,6 +904,13 @@ def filter_stream_authorization(if not stream.invite_only and not user_profile.is_guest:continue+ if stream.invite_only:+ user_recursive_group_ids = set(+ get_recursive_membership_groups(user_profile).values_list("id", flat=True)+ )+ if is_user_in_can_add_subscribers_group(stream, user_recursive_group_ids):+ continue+unauthorized_streams.append(stream)authorized_streams = [diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex 569238f7f47..38bb57af544 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -10445,7 +10445,13 @@ paths:channel depends on the [channel's type: private, public, orweb-public](/help/channel-permissions).- **Changes**: Removed `stream_post_policy` and `is_announcement_only`+ **Changes**: Before Zulip 10.0 (feature level 349), a user cannot+ subscribe other users to a private channel without being subscribed+ to that channel themselves. Now, If a user is part of+ `can_add_subscribers_group`, they can subscribe themselves or other+ users to a private channel without being subscribed to that channel.++ Removed `stream_post_policy` and `is_announcement_only`parameters in Zulip 10.0 (feature level 333), as permission to postin the channel is now controlled by `can_send_message_group`.diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.pyindex f270288fde9..12ceb462be9 100644--- a/zerver/tests/test_subs.py+++ b/zerver/tests/test_subs.py@@ -5342,6 +5342,20 @@ class SubscriptionAPITest(ZulipTestCase):do_change_stream_group_based_setting(private_stream, "can_add_subscribers_group", members_group, acting_user=None)+ result = self.subscribe_via_post(+ self.test_user,+ ["private_stream"],+ {"principals": orjson.dumps([invitee_user_id]).decode()},+ )+ self.assert_json_success(result)+ do_change_stream_group_based_setting(+ private_stream, "can_add_subscribers_group", nobody_group, acting_user=None+ )+ self.unsubscribe(user_profile, "private_stream")++ do_change_stream_group_based_setting(+ private_stream, "can_administer_channel_group", members_group, acting_user=None+ )result = self.subscribe_via_post(self.test_user,["private_stream"],