Skip to content

Commit

Permalink
Fix JDBC role service check error message
Browse files Browse the repository at this point in the history
  • Loading branch information
index-git committed Jan 2, 2024
1 parent c64d6b0 commit 6934acf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/layman/authz/role_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ def validate_role_table():
if roles:
raise Exception(f"Roles not matching pattern '{ROLE_NAME_PATTERN}' in JDBC Role service: {[role[0] for role in roles]}")

not_expected_roles = [settings.RIGHTS_EVERYONE_ROLE, ] + gs_util.RESERVED_ROLE_NAMES
query = f"""
select name
from {settings.LAYMAN_ROLE_SERVICE_SCHEMA}.roles
where name = any(%s)
"""
roles = db_util.run_query(query, ([settings.RIGHTS_EVERYONE_ROLE, ] + gs_util.RESERVED_ROLE_NAMES,), uri_str=settings.LAYMAN_ROLE_SERVICE_URI)
roles = db_util.run_query(query, (not_expected_roles,), uri_str=settings.LAYMAN_ROLE_SERVICE_URI)
if roles:
raise Exception(f"Role '{settings.RIGHTS_EVERYONE_ROLE}' should not be in JDBC Role service.")
raise Exception(f"Roles {not_expected_roles} should not be in JDBC Role service.")

query = f"""
select name
Expand Down

0 comments on commit 6934acf

Please sign in to comment.