Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

streams: Add realm check in can_access_stream_history.

Mateusz Mandera68d1f2d7ef13
diff --git a/zerver/lib/streams.py b/zerver/lib/streams.py
index b22405fb826..fb6490f5a95 100644
--- a/zerver/lib/streams.py
+++ b/zerver/lib/streams.py
@@ -494,6 +494,10 @@ def can_access_stream_history(user_profile: UserProfile, stream: Stream) -> bool
access_stream is being called elsewhere to confirm that the user
can actually see this stream.
"""
+
+ if user_profile.realm_id != stream.realm_id:
+ raise AssertionError("user_profile and stream realms don't match")
+
if stream.is_web_public:
return True