RBAC Diagram+PostgreSQL Generator #21

Merged
hsh-michaelhoennig merged 54 commits from experimental-rbacview-generator into master 2024-03-11 12:30:44 +01:00
5 changed files with 14 additions and 13 deletions
Showing only changes of commit 9ecfdc722a - Show all commits

View File

@ -48,7 +48,7 @@ public class InsertTriggerGenerator {
permissionUuid uuid; permissionUuid uuid;
roleUuid uuid; roleUuid uuid;
begin begin
call defineContext('generated Liquibase: create INSERT INTO ${rawSubTableName} permissions for the related ${rawSuperTableName} rows'); call defineContext('create INSERT INTO ${rawSubTableName} permissions for the related ${rawSuperTableName} rows');
FOR row IN SELECT * FROM ${rawSuperTableName} FOR row IN SELECT * FROM ${rawSuperTableName}
LOOP LOOP

View File

@ -23,13 +23,15 @@ end; $$;
Defines the transaction context. Defines the transaction context.
*/ */
create or replace procedure defineContext( create or replace procedure defineContext(
currentTask varchar, currentTask varchar(96),
currentRequest varchar = null, currentRequest varchar(512) = null,
currentUser varchar = null, currentUser varchar = null,
assumedRoles varchar = null assumedRoles varchar = null
) )
language plpgsql as $$ language plpgsql as $$
begin begin
assert length(currentTask) <= 96, 'currentTask must not be longer than 96 characters';
assert length(currentTask) > 8, 'currentTask must be at least 8 characters long';
execute format('set local hsadminng.currentTask to %L', currentTask); execute format('set local hsadminng.currentTask to %L', currentTask);
currentRequest := coalesce(currentRequest, ''); currentRequest := coalesce(currentRequest, '');
@ -66,11 +68,10 @@ begin
when others then when others then
currentTask := null; currentTask := null;
end; end;
-- FIXME: uncomment if (currentTask is null or currentTask = '') then
-- if (currentTask is null or currentTask = '') then raise exception '[401] currentTask must be defined, please call `defineContext(...)`';
-- raise exception '[401] currentTask must be defined, please call `defineContext(...)`'; end if;
-- end if; return currentTask;
return 'unknown'; -- FIXME: currentTask;
end; $$; end; $$;
--// --//

View File

@ -1,5 +1,5 @@
--liquibase formatted sql --liquibase formatted sql
-- This code generated was by RbacViewPostgresGenerator at 2024-03-07T12:25:36.376742633. -- This code generated was by RbacViewPostgresGenerator at 2024-03-07T14:39:25.446629076.
-- ============================================================================ -- ============================================================================

View File

@ -1,5 +1,5 @@
--liquibase formatted sql --liquibase formatted sql
-- This code generated was by RbacViewPostgresGenerator at 2024-03-07T12:25:36.422351715. -- This code generated was by RbacViewPostgresGenerator at 2024-03-07T14:39:25.488573238.
-- ============================================================================ -- ============================================================================
@ -157,7 +157,7 @@ do language plpgsql $$
permissionUuid uuid; permissionUuid uuid;
roleUuid uuid; roleUuid uuid;
begin begin
call defineContext('generated Liquibase: create INSERT INTO test_package permissions for the related test_customer rows'); call defineContext('create INSERT INTO test_package permissions for the related test_customer rows');
FOR row IN SELECT * FROM test_customer FOR row IN SELECT * FROM test_customer
LOOP LOOP

View File

@ -4,8 +4,8 @@ spring:
platform: postgres platform: postgres
datasource: datasource:
url-tc: jdbc:tc:postgresql:15.5-bookworm:///spring_boot_testcontainers url: jdbc:tc:postgresql:15.5-bookworm:///spring_boot_testcontainers
url: jdbc:postgresql://localhost:5432/postgres url-local: jdbc:postgresql://localhost:5432/postgres
username: postgres username: postgres
password: password password: password