diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index 6c1df4c79a..063f7900c3 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -6585,7 +6585,7 @@ def do_get_streams( ) -> List[Dict[str, Any]]: # This function is only used by API clients now. - if include_all_active and not user_profile.can_forge_sender: + if include_all_active and not user_profile.is_realm_admin: raise JsonableError(_("User not authorized for this query")) include_public = include_public and user_profile.can_access_public_streams() diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.py index 2dcb53265e..dae048fabe 100644 --- a/zerver/tests/test_subs.py +++ b/zerver/tests/test_subs.py @@ -4583,27 +4583,11 @@ class GetStreamsTest(ZulipTestCase): result = self.api_get(normal_user, url, data) self.assertEqual(result.status_code, 400) - # Even realm admin users can't see all - # active streams (without additional privileges). + # Realm admin users can see all active streams. admin_user = self.example_user("iago") self.assertTrue(admin_user.is_realm_admin) + result = self.api_get(admin_user, url, data) - self.assertEqual(result.status_code, 400) - - """ - HAPPY PATH: - - We can get all active streams ONLY if we are - an API "super user". We typically create - api-super-user accounts for things like - Zephyr/Jabber mirror API users, but here - we just "knight" Hamlet for testing expediency. - """ - super_user = self.example_user("hamlet") - super_user.can_forge_sender = True - super_user.save() - - result = self.api_get(super_user, url, data) self.assert_json_success(result) json = result.json()