Skip to content

Commit

Permalink
Fix CheckMediafileId presenter for anonymous user (#2434)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianjoel authored May 24, 2024
1 parent eaa0e86 commit 7fbc7ce
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions openslides_backend/presenter/check_mediafile_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def check_permissions(

meeting = self.datastore.get(
fqid_from_collection_and_id("meeting", owner_id),
["enable_anonymous", "user_ids", "committee_id"],
["enable_anonymous", "user_ids", "committee_id", "default_group_id"],
)
# The user is admin of the meeting.
if is_admin(self.datastore, self.user_id, owner_id):
Expand Down Expand Up @@ -138,9 +138,13 @@ def check_permissions(
inherited_access_group_ids = set(
mediafile.get("inherited_access_group_ids", [])
)
user_groups = set(
get_groups_from_meeting_user(self.datastore, owner_id, self.user_id)
)
if self.user_id == 0 and meeting["enable_anonymous"]:
user_groups = set([meeting["default_group_id"]])
else:
user_groups = set(
get_groups_from_meeting_user(self.datastore, owner_id, self.user_id)
)

if inherited_access_group_ids & user_groups:
return
raise PermissionDenied("You are not allowed to see this mediafile.")
Expand Down

0 comments on commit 7fbc7ce

Please sign in to comment.