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):