Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Oct 11, 2024
1 parent 220a132 commit 3b28062
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions validation_service_api/validation_service/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def get_kg_client_for_user_account(token):


async def get_collab_info(collab_id, token):
assert len(collab_id) > 0
collab_info_url = f"{settings.HBP_COLLAB_SERVICE_URL}collabs/{collab_id}"
headers = {"Authorization": f"Bearer {token.credentials}"}
res = requests.get(collab_info_url, headers=headers)
Expand All @@ -57,6 +58,7 @@ async def get_collab_info(collab_id, token):
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST, detail="Invalid collab id"
)
assert isinstance(response, dict), collab_info_url
return response


Expand Down Expand Up @@ -138,6 +140,7 @@ async def get_collab_permissions(self, collab_id):
else:
assert highest_collab_role is None
collab_info = await self.get_collab_info(collab_id)
assert isinstance(collab_info, dict), f"{collab_id}: {collab_info}"
if collab_info.get("isPublic", False): # will be False if 404 collab not found
permissions = {"VIEW": True, "UPDATE": False}
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ async def create_model_instance(
detail=f"Unable to determine access permissions - please contact EBRAINS support"
)
collab_id = model_project.space[len("collab-"):]
assert len(collab_id) > 0, f"{model_id} {model_project.space}"
if not (
await user.can_edit_collab(collab_id)
or await user.is_admin()
Expand Down

0 comments on commit 3b28062

Please sign in to comment.