fix logic for roles
This commit is contained in:
parent
732555ac6a
commit
19802f56eb
2 changed files with 5 additions and 8 deletions
|
@ -9,9 +9,4 @@ class RoleService:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_role_by_id(role_id):
|
def get_role_by_id(role_id):
|
||||||
if role_id is None:
|
|
||||||
role = Role()
|
|
||||||
role.name = 'user'
|
|
||||||
return role
|
|
||||||
|
|
||||||
return Role.query.filter_by(id=role_id).first()
|
return Role.query.filter_by(id=role_id).first()
|
||||||
|
|
|
@ -262,9 +262,11 @@ def consent():
|
||||||
.filter(AppRole.user_id == user.uuid)
|
.filter(AppRole.user_id == user.uuid)
|
||||||
)
|
)
|
||||||
for role_obj in role_objects:
|
for role_obj in role_objects:
|
||||||
role_name = RoleService.get_role_by_id(role_obj.role_id).name
|
app_role = RoleService.get_role_by_id(role_obj.role_id)
|
||||||
if (role_name is not None):
|
if (app_role is None):
|
||||||
roles.append(role_name)
|
roles.append('user')
|
||||||
|
continue
|
||||||
|
roles.append(app_role.name)
|
||||||
|
|
||||||
current_app.logger.info(f"Using '{roles}' when applying consent for {kratos_id}")
|
current_app.logger.info(f"Using '{roles}' when applying consent for {kratos_id}")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue