Skip to content

Commit

Permalink
Added role resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Kosta91 committed Aug 22, 2023
1 parent af2346c commit 3bbad4e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion superset/header_auth_security_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,20 @@ def __get_or_create_user(self, username):
if token_payload:
first_name = token_payload.get("given_name", first_name)
last_name = token_payload.get("family_name", last_name)

groups = token_payload.get("groups")
if "admin" in groups:
role_name = ab_security_manager.auth_role_admin
else:
# The default authentication role should be defined in helm/superset/values.yaml as AUTH_USER_REGISTRATION_ROLE
role_name = ab_security_manager.auth_user_registration_role

user = ab_security_manager.add_user(
username=username,
first_name=first_name,
last_name=last_name,
email=email,
role=ab_security_manager.find_role(ab_security_manager.auth_user_registration_role),
role = ab_security_manager.find_role(role_name)
)

return user
Expand Down

0 comments on commit 3bbad4e

Please sign in to comment.