Compare commits

..

No commits in common. "1fb1dcce50b63503d42a5325cba0278354188675" and "9ecfdc722adf5d21e9423a0ade0682c004770b94" have entirely different histories.

4 changed files with 21 additions and 25 deletions

View File

@ -14,7 +14,6 @@ import java.util.UUID;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.GLOBAL; 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.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.Role.*;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.rbacViewFor; import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.rbacViewFor;
@ -43,7 +42,7 @@ public class TestCustomerEntity implements HasUuid {
.withUpdatableColumns("reference", "prefix", "adminUserName") .withUpdatableColumns("reference", "prefix", "adminUserName")
.createRole(OWNER, (with) -> { .createRole(OWNER, (with) -> {
with.owningUser(CREATOR); // with.owningUser(CREATOR); FIXME: needs assumed role, was: getRbacUserId(NEW.adminUserName, 'create')
with.incomingSuperRole(GLOBAL, ADMIN); with.incomingSuperRole(GLOBAL, ADMIN);
with.permission(DELETE); with.permission(DELETE);
}) })

View File

@ -366,17 +366,17 @@ create trigger deleteRbacRolesOfRbacObject_Trigger
*/ */
create domain RbacOp as varchar(67) -- TODO: shorten to 8, once the deprecated values are gone create domain RbacOp as varchar(67) -- TODO: shorten to 8, once the deprecated values are gone
-- FIXME: -- FIXME: uncomment check
-- check ( -- check (
-- VALUE = 'DELETE' -- VALUE = 'INSERT' or
-- or VALUE = 'UPDATE' -- VALUE = 'DELETE' or
-- or VALUE = 'SELECT' -- VALUE = 'UPDATE' or
-- or VALUE = 'INSERT' -- VALUE = 'SELECT' or
-- or VALUE = 'ASSUME' -- VALUE = 'ASSUME' or
-- -- TODO: all values below are deprecated, use insert with table -- -- TODO: all values below are deprecated, use insert with table
-- or VALUE ~ '^add-[a-z]+$' -- VALUE ~ '^add-[a-z]+$' or
-- or VALUE ~ '^new-[a-z-]+$' -- VALUE ~ '^new-[a-z-]+$'
-- ) -- );
; ;
create table RbacPermission create table RbacPermission
@ -408,20 +408,18 @@ begin
permissionUuid = (select uuid from RbacPermission where objectUuid = forObjectUuid and op = forOp and opTableName = forOpTableName); permissionUuid = (select uuid from RbacPermission where objectUuid = forObjectUuid and op = forOp and opTableName = forOpTableName);
if (permissionUuid is null) then if (permissionUuid is null) then
insert into RbacReference ("type") insert
into RbacReference ("type")
values ('RbacPermission') values ('RbacPermission')
returning uuid into permissionUuid; returning uuid into permissionUuid;
begin raise warning 'for values (%, %, %, %)', permissionUuid, forObjectUuid, forOp, forOpTableName; -- TODO: remove
insert into RbacPermission (uuid, objectUuid, op, opTableName) insert
into RbacPermission (uuid, objectUuid, op, opTableName)
values (permissionUuid, forObjectUuid, forOp, forOpTableName); values (permissionUuid, forObjectUuid, forOp, forOpTableName);
exception
when others then
raise exception 'insert into RbacPermission (uuid, objectUuid, op, opTableName)
values (%, %, %, %);', permissionUuid, forObjectUuid, forOp, forOpTableName;
end;
end if; end if;
return permissionUuid; return permissionUuid;
end; $$; end;
$$;
-- TODO: deprecated, remove and amend all usages to createPermission -- TODO: deprecated, remove and amend all usages to createPermission
create or replace function createPermissions(forObjectUuid uuid, permitOps RbacOp[]) create or replace function createPermissions(forObjectUuid uuid, permitOps RbacOp[])

View File

@ -1,5 +1,5 @@
--liquibase formatted sql --liquibase formatted sql
-- This code generated was by RbacViewPostgresGenerator at 2024-03-07T15:57:25.487712422. -- This code generated was by RbacViewPostgresGenerator at 2024-03-07T14:39:25.446629076.
-- ============================================================================ -- ============================================================================
@ -38,7 +38,6 @@ begin
perform createRoleWithGrants( perform createRoleWithGrants(
testCustomerOwner(NEW), testCustomerOwner(NEW),
permissions => array['DELETE'], permissions => array['DELETE'],
userUuids => array[currentUserUuid()],
incomingSuperRoles => array[globalAdmin()] incomingSuperRoles => array[globalAdmin()]
); );

View File

@ -1,5 +1,5 @@
--liquibase formatted sql --liquibase formatted sql
-- This code generated was by RbacViewPostgresGenerator at 2024-03-07T15:57:25.536171618. -- This code generated was by RbacViewPostgresGenerator at 2024-03-07T14:39:25.488573238.
-- ============================================================================ -- ============================================================================