Skip to content

Commit

Permalink
Allow admin to access all projects.
Browse files Browse the repository at this point in the history
  • Loading branch information
fxbru committed Mar 29, 2024
1 parent cc96364 commit 3db4b17
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/projects/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from app.constants import (
EXTRACT_FOLDER_NAME,
PROJECTS_SRC_PATH,
ROLE_ADMIN,
SCC,
SEVERITY_CRITICAL,
SEVERITY_HIGH,
Expand Down Expand Up @@ -295,9 +296,10 @@ def get_user_projects_ids(current_user):
return projects_id_list

def has_access(current_user, project):
if current_user.role == ROLE_ADMIN:
return True
user_teams = set(Team.query.filter(Team.members.any(username=current_user.username)).all())
project_teams = set(Team.query.filter(Team.projects.any(name=project.name)).all())

if user_teams.isdisjoint(project_teams):
return False
else:
Expand Down

0 comments on commit 3db4b17

Please sign in to comment.