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;
roleUuid uuid;
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}
LOOP

View File

@ -23,13 +23,15 @@ end; $$;
Defines the transaction context.
*/
create or replace procedure defineContext(
currentTask varchar,
currentRequest varchar = null,
currentTask varchar(96),
currentRequest varchar(512) = null,
currentUser varchar = null,
assumedRoles varchar = null
)
language plpgsql as $$
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);
currentRequest := coalesce(currentRequest, '');
@ -66,11 +68,10 @@ begin
when others then
currentTask := null;
end;
-- FIXME: uncomment
-- if (currentTask is null or currentTask = '') then
-- raise exception '[401] currentTask must be defined, please call `defineContext(...)`';
-- end if;
return 'unknown'; -- FIXME: currentTask;
if (currentTask is null or currentTask = '') then
raise exception '[401] currentTask must be defined, please call `defineContext(...)`';
end if;
return currentTask;
end; $$;
--//

View File

@ -1,5 +1,5 @@
--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
-- 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;
roleUuid uuid;
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
LOOP

View File

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