From 6934acf95454a6aa08760fcd108c9e0629da4665 Mon Sep 17 00:00:00 2001 From: index-git Date: Tue, 2 Jan 2024 11:27:50 +0100 Subject: [PATCH] Fix JDBC role service check error message --- src/layman/authz/role_service.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/layman/authz/role_service.py b/src/layman/authz/role_service.py index 4b05a9cd9..f593106d7 100644 --- a/src/layman/authz/role_service.py +++ b/src/layman/authz/role_service.py @@ -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