From ab6ce48fad25580d425732ae2f7290dd4388a23c Mon Sep 17 00:00:00 2001 From: index-git Date: Thu, 14 Dec 2023 18:44:02 +0100 Subject: [PATCH] Add LAYMAN_GS_ROLE to all users --- src/layman/authz/role_service.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/layman/authz/role_service.py b/src/layman/authz/role_service.py index c674c39b5..b875cca15 100644 --- a/src/layman/authz/role_service.py +++ b/src/layman/authz/role_service.py @@ -23,8 +23,13 @@ def ensure_admin_roles(): select %s, 'ADMIN' UNION ALL select %s, 'ADMIN' + union all + select w.name as username, + %s as rolename + from {settings.LAYMAN_PRIME_SCHEMA}.users u inner join + {settings.LAYMAN_PRIME_SCHEMA}.workspaces w on w.id = u.id_workspace ;""" - db_util.run_statement(create_admin_user_roles_view, (settings.LAYMAN_GS_USER, settings.LAYMAN_GS_ROLE, settings.LAYMAN_GS_USER, settings.GEOSERVER_ADMIN_USER, )) + db_util.run_statement(create_admin_user_roles_view, (settings.LAYMAN_GS_USER, settings.LAYMAN_GS_ROLE, settings.LAYMAN_GS_USER, settings.GEOSERVER_ADMIN_USER, settings.LAYMAN_GS_ROLE, )) def get_user_roles(username):