Skip to content

Commit

Permalink
fix(project): corrects usergroup role check in whoami command (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
pallabpain authored and RomilShah committed May 29, 2024
1 parent 6867017 commit bb5343e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions riocli/project/whoami.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,16 @@ def find_role(
raise e

for group in project.spec.get('userGroups', []):
if group['name'] in user_groups:
if (not role) or (role != ADMIN_ROLE and group['role'] == ADMIN_ROLE):
role = group['role']
break
if group['name'] not in user_groups:
continue

# If the user is part of a group that has admin access then no
# need to check further.
if role and (role != ADMIN_ROLE and group['role'] == ADMIN_ROLE):
role = ADMIN_ROLE
break

role = group['role']

if not role:
raise Exception('User does not have access to the project')
Expand Down

0 comments on commit bb5343e

Please sign in to comment.