Skip to content

Commit 2ade6b5

Browse files
author
Alan Christie
committed
fix: Jobn execution now checks project membership
1 parent ad77127 commit 2ade6b5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

viewer/squonk2_agent.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -746,11 +746,11 @@ def _verify_access(self, c_params: CommonParams) -> Squonk2AgentRv:
746746
target_access_string = self._get_target_access_string(access_id)
747747
assert target_access_string
748748
proposal_list: List[str] = self.__ispyb_safe_query_set.get_proposals_for_user(
749-
user
749+
user, restrict_to_membership=True
750750
)
751751
if not target_access_string in proposal_list:
752752
msg = (
753-
f'The user ({user.username}) cannot access "{target_access_string}"'
753+
f'The user ({user.username}) cannot modify "{target_access_string}"'
754754
f' (access_id={access_id}). Only {proposal_list})'
755755
)
756756
_LOGGER.warning(msg)

viewer/views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,7 @@ def create(self, request, *args, **kwargs):
15611561
f"You are not authorized to upload data to {target_access_string}"
15621562
]
15631563
},
1564-
status=status.HTTP_400_BAD_REQUEST,
1564+
status=status.HTTP_403_FORBIDDEN,
15651565
)
15661566

15671567
# memo to self: cannot use TemporaryDirectory here because task

0 commit comments

Comments
 (0)