diff --git a/areas/roles/role_service.py b/areas/roles/role_service.py index 4b44793..7d70f99 100644 --- a/areas/roles/role_service.py +++ b/areas/roles/role_service.py @@ -9,9 +9,4 @@ class RoleService: @staticmethod 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() diff --git a/web/login/login.py b/web/login/login.py index 258df32..e33b974 100644 --- a/web/login/login.py +++ b/web/login/login.py @@ -262,9 +262,11 @@ def consent(): .filter(AppRole.user_id == user.uuid) ) for role_obj in role_objects: - role_name = RoleService.get_role_by_id(role_obj.role_id).name - if (role_name is not None): - roles.append(role_name) + app_role = RoleService.get_role_by_id(role_obj.role_id) + if (app_role is None): + roles.append('user') + continue + roles.append(app_role.name) current_app.logger.info(f"Using '{roles}' when applying consent for {kratos_id}")