Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(project): corrects usergroup role check in whoami command #291

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading