Skip to content

Commit cd2a811

Browse files
committed
changes
1 parent 934f952 commit cd2a811

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

backend/api/submissions/permissions.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,21 @@ class CanSeeSubmissionPrivateFields(BasePermission):
5252
message = "You can't see the private fields for this submission"
5353

5454
def has_permission(self, source, info):
55+
from api.participants.types import Participant
56+
5557
user = info.context.request.user
5658

5759
if not user.is_authenticated:
5860
return False
5961

60-
return user.is_staff or source.speaker_id == user.id
62+
if isinstance(source, Submission):
63+
source_user_id = source.speaker_id
64+
elif isinstance(source, Participant):
65+
source_user_id = source._user_id
66+
else:
67+
raise ValueError("Invalid source type")
68+
69+
return user.is_staff or source_user_id == user.id
6170

6271

6372
class IsSubmissionSpeakerOrStaff(BasePermission):

backend/api/submissions/tests/test_submissions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def test_max_allowed_page_size(graphql_client, user):
181181
variables={"code": submission.conference.code},
182182
)
183183

184-
assert resp["errors"][0]["message"] == "Page size cannot be greater than 150"
184+
assert resp["errors"][0]["message"] == "Page size cannot be greater than 300"
185185
assert resp["data"]["submissions"] is None
186186

187187

0 commit comments

Comments
 (0)