Skip to content

Commit

Permalink
respect superuser flag when activating project
Browse files Browse the repository at this point in the history
  • Loading branch information
jkupka committed Apr 22, 2022
1 parent 25e2fad commit ef46ded
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pandahub/lib/PandaHub.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,10 @@ def _get_project_document(self, filter_dict: dict) -> Optional[dict]:
if len(projects) > 1:
raise PandaHubError("Duplicate Project detected. This should never happen if you create projects through the API. Remove duplicate projects manually in the database.")
project_doc = projects[0]
user = self._get_user()
if "users" not in project_doc:
return project_doc #project is not user protected
elif self.user_id not in project_doc["users"].keys():
elif not user["is_superuser"] and self.user_id not in project_doc["users"].keys():
raise PandaHubError("You don't have rights to access this project", 403)
elif project_doc.get("locked") and project_doc.get("locked_by") != self.user_id:
raise PandaHubError("Project is locked by another user")
Expand Down

0 comments on commit ef46ded

Please sign in to comment.