mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 22:43:42 +00:00
streams: Update error message returned for administrative access.
We have now decided to not continue with the stream administrator concept as we are changing the permissions model to be based on user groups as per #19525. So, this commit updates the error message to "Must be an organization administrator".
This commit is contained in:
@@ -241,17 +241,6 @@ class OrganizationOwnerRequired(JsonableError):
|
||||
return _("Must be an organization owner")
|
||||
|
||||
|
||||
class StreamAdministratorRequired(JsonableError):
|
||||
code: ErrorCode = ErrorCode.UNAUTHORIZED_PRINCIPAL
|
||||
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def msg_format() -> str:
|
||||
return _("Must be an organization or stream administrator")
|
||||
|
||||
|
||||
class AuthenticationFailedError(JsonableError):
|
||||
# Generic class for authentication failures
|
||||
code: ErrorCode = ErrorCode.AUTHENTICATION_FAILED
|
||||
|
||||
@@ -9,8 +9,8 @@ from django.utils.translation import gettext as _
|
||||
from zerver.actions.default_streams import get_default_streams_for_realm
|
||||
from zerver.lib.exceptions import (
|
||||
JsonableError,
|
||||
OrganizationAdministratorRequired,
|
||||
OrganizationOwnerRequired,
|
||||
StreamAdministratorRequired,
|
||||
)
|
||||
from zerver.lib.markdown import markdown_convert
|
||||
from zerver.lib.stream_subscription import (
|
||||
@@ -315,7 +315,7 @@ def check_stream_access_for_delete_or_update(
|
||||
if sub is not None and sub.is_stream_admin:
|
||||
return
|
||||
|
||||
raise StreamAdministratorRequired()
|
||||
raise OrganizationAdministratorRequired()
|
||||
|
||||
|
||||
def access_stream_for_delete_or_update(
|
||||
|
||||
@@ -549,7 +549,7 @@ class StreamAdminTest(ZulipTestCase):
|
||||
stream = self.subscribe(user_profile, "private_stream_2")
|
||||
result = self.client_patch(f"/json/streams/{stream.id}", params)
|
||||
self.assertTrue(stream.invite_only)
|
||||
self.assert_json_error(result, "Must be an organization or stream administrator")
|
||||
self.assert_json_error(result, "Must be an organization administrator")
|
||||
|
||||
sub = get_subscription("private_stream_2", user_profile)
|
||||
do_change_subscription_property(
|
||||
@@ -677,7 +677,7 @@ class StreamAdminTest(ZulipTestCase):
|
||||
stream = self.subscribe(user_profile, "public_stream_2")
|
||||
result = self.client_patch(f"/json/streams/{stream.id}", params)
|
||||
self.assertFalse(stream.invite_only)
|
||||
self.assert_json_error(result, "Must be an organization or stream administrator")
|
||||
self.assert_json_error(result, "Must be an organization administrator")
|
||||
|
||||
sub = get_subscription("public_stream_2", user_profile)
|
||||
do_change_subscription_property(
|
||||
@@ -914,7 +914,7 @@ class StreamAdminTest(ZulipTestCase):
|
||||
"history_public_to_subscribers": orjson.dumps(True).decode(),
|
||||
}
|
||||
result = self.client_patch(f"/json/streams/{stream_id}", params)
|
||||
self.assert_json_error(result, "Must be an organization or stream administrator")
|
||||
self.assert_json_error(result, "Must be an organization administrator")
|
||||
|
||||
do_set_realm_property(
|
||||
realm, "create_web_public_stream_policy", Realm.POLICY_OWNERS_ONLY, acting_user=None
|
||||
@@ -1335,7 +1335,7 @@ class StreamAdminTest(ZulipTestCase):
|
||||
self.assertFalse(sub.is_stream_admin)
|
||||
|
||||
result = self.client_delete(f"/json/streams/{stream.id}")
|
||||
self.assert_json_error(result, "Must be an organization or stream administrator")
|
||||
self.assert_json_error(result, "Must be an organization administrator")
|
||||
|
||||
def test_private_stream_live_updates(self) -> None:
|
||||
user_profile = self.example_user("hamlet")
|
||||
@@ -1528,7 +1528,7 @@ class StreamAdminTest(ZulipTestCase):
|
||||
|
||||
stream_id = get_stream("stream_name1", user_profile.realm).id
|
||||
result = self.client_patch(f"/json/streams/{stream_id}", {"new_name": "stream_name2"})
|
||||
self.assert_json_error(result, "Must be an organization or stream administrator")
|
||||
self.assert_json_error(result, "Must be an organization administrator")
|
||||
|
||||
def test_notify_on_stream_rename(self) -> None:
|
||||
user_profile = self.example_user("hamlet")
|
||||
@@ -1819,7 +1819,7 @@ class StreamAdminTest(ZulipTestCase):
|
||||
result = self.client_patch(
|
||||
f"/json/streams/{stream_id}", {"description": "Test description"}
|
||||
)
|
||||
self.assert_json_error(result, "Must be an organization or stream administrator")
|
||||
self.assert_json_error(result, "Must be an organization administrator")
|
||||
|
||||
def test_change_to_stream_post_policy_admins(self) -> None:
|
||||
user_profile = self.example_user("hamlet")
|
||||
@@ -1881,7 +1881,7 @@ class StreamAdminTest(ZulipTestCase):
|
||||
result = self.client_patch(
|
||||
f"/json/streams/{stream_id}", {"stream_post_policy": orjson.dumps(policy).decode()}
|
||||
)
|
||||
self.assert_json_error(result, "Must be an organization or stream administrator")
|
||||
self.assert_json_error(result, "Must be an organization administrator")
|
||||
|
||||
policies = [
|
||||
Stream.STREAM_POST_POLICY_ADMINS,
|
||||
@@ -2453,7 +2453,7 @@ class StreamAdminTest(ZulipTestCase):
|
||||
invite_only=False,
|
||||
target_users_subbed=True,
|
||||
)
|
||||
self.assert_json_error(result, "Must be an organization or stream administrator")
|
||||
self.assert_json_error(result, "Must be an organization administrator")
|
||||
|
||||
def test_realm_admin_remove_others_from_public_stream(self) -> None:
|
||||
"""
|
||||
@@ -2600,7 +2600,7 @@ class StreamAdminTest(ZulipTestCase):
|
||||
target_users_subbed=True,
|
||||
using_legacy_emails=True,
|
||||
)
|
||||
self.assert_json_error(result, "Must be an organization or stream administrator")
|
||||
self.assert_json_error(result, "Must be an organization administrator")
|
||||
|
||||
def test_admin_remove_others_from_stream_legacy_emails(self) -> None:
|
||||
result = self.attempt_unsubscribe_of_principal(
|
||||
|
||||
Reference in New Issue
Block a user