From 1fb1dcce50b63503d42a5325cba0278354188675 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 7 Mar 2024 16:03:44 +0100 Subject: [PATCH] .createRole().with.owningUser(CREATOR) is not working --- .../hostsharing/hsadminng/test/cust/TestCustomerEntity.java | 3 ++- src/main/resources/db/changelog/113-test-customer-rbac.sql | 3 ++- src/main/resources/db/changelog/123-test-package-rbac.sql | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/hostsharing/hsadminng/test/cust/TestCustomerEntity.java b/src/main/java/net/hostsharing/hsadminng/test/cust/TestCustomerEntity.java index d419806e..21a5f650 100644 --- a/src/main/java/net/hostsharing/hsadminng/test/cust/TestCustomerEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/test/cust/TestCustomerEntity.java @@ -14,6 +14,7 @@ import java.util.UUID; import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.GLOBAL; import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.Permission.*; +import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.RbacUserReference.UserRole.CREATOR; import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.Role.*; import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.rbacViewFor; @@ -42,7 +43,7 @@ public class TestCustomerEntity implements HasUuid { .withUpdatableColumns("reference", "prefix", "adminUserName") .createRole(OWNER, (with) -> { - // with.owningUser(CREATOR); FIXME: needs assumed role, was: getRbacUserId(NEW.adminUserName, 'create') + with.owningUser(CREATOR); with.incomingSuperRole(GLOBAL, ADMIN); with.permission(DELETE); }) diff --git a/src/main/resources/db/changelog/113-test-customer-rbac.sql b/src/main/resources/db/changelog/113-test-customer-rbac.sql index f62be84b..bdd01a62 100644 --- a/src/main/resources/db/changelog/113-test-customer-rbac.sql +++ b/src/main/resources/db/changelog/113-test-customer-rbac.sql @@ -1,5 +1,5 @@ --liquibase formatted sql --- This code generated was by RbacViewPostgresGenerator at 2024-03-07T14:39:25.446629076. +-- This code generated was by RbacViewPostgresGenerator at 2024-03-07T15:57:25.487712422. -- ============================================================================ @@ -38,6 +38,7 @@ begin perform createRoleWithGrants( testCustomerOwner(NEW), permissions => array['DELETE'], + userUuids => array[currentUserUuid()], incomingSuperRoles => array[globalAdmin()] ); diff --git a/src/main/resources/db/changelog/123-test-package-rbac.sql b/src/main/resources/db/changelog/123-test-package-rbac.sql index 2d4ac417..f36eacee 100644 --- a/src/main/resources/db/changelog/123-test-package-rbac.sql +++ b/src/main/resources/db/changelog/123-test-package-rbac.sql @@ -1,5 +1,5 @@ --liquibase formatted sql --- This code generated was by RbacViewPostgresGenerator at 2024-03-07T14:39:25.488573238. +-- This code generated was by RbacViewPostgresGenerator at 2024-03-07T15:57:25.536171618. -- ============================================================================