mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
statistics: Guest user can't access realm statistics.
Don't allow guest user to access realm statistics from UI or at API level. Fixes part of #10749.
This commit is contained in:
committed by
Tim Abbott
parent
f6b4e65b92
commit
02a5849d4c
@@ -24,6 +24,15 @@ class TestStatsEndpoint(ZulipTestCase):
|
||||
# Check that we get something back
|
||||
self.assert_in_response("Zulip analytics for", result)
|
||||
|
||||
def test_guest_user_cant_access_stats(self) -> None:
|
||||
self.user = self.example_user('polonius')
|
||||
self.login(self.user.email)
|
||||
result = self.client_get('/stats')
|
||||
self.assert_json_error(result, "Not allowed for guest users", 400)
|
||||
|
||||
result = self.client_get('/json/analytics/chart_data')
|
||||
self.assert_json_error(result, "Not allowed for guest users", 400)
|
||||
|
||||
def test_stats_for_realm(self) -> None:
|
||||
user_profile = self.example_user('hamlet')
|
||||
self.login(user_profile.email)
|
||||
|
||||
Reference in New Issue
Block a user