diff --git a/src/main/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleController.java b/src/main/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleController.java index cf528361..0405fee2 100644 --- a/src/main/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleController.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleController.java @@ -31,7 +31,7 @@ public class RbacRoleController implements RbacRolesApi { context.define(currentUser, assumedRoles); - final List result = rbacRoleRepository.findAll(); + final List result = rbacRoleRepository.findAll(); return ResponseEntity.ok(mapper.mapList(result, RbacRoleResource.class)); } diff --git a/src/main/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleRvEntity.java b/src/main/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleEntity.java similarity index 96% rename from src/main/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleRvEntity.java rename to src/main/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleEntity.java index d174182a..fa21785a 100644 --- a/src/main/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleRvEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleEntity.java @@ -15,7 +15,7 @@ import java.util.UUID; @Immutable @NoArgsConstructor @AllArgsConstructor -public class RbacRoleRvEntity { +public class RbacRoleEntity { @Id @GeneratedValue diff --git a/src/main/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleRepository.java b/src/main/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleRepository.java index 2d9d005b..94633d7c 100644 --- a/src/main/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleRepository.java @@ -5,7 +5,7 @@ import org.springframework.data.repository.Repository; import java.util.List; import java.util.UUID; -public interface RbacRoleRepository extends Repository { +public interface RbacRoleRepository extends Repository { /** * @return the number of persistent RbacRoleEntity instances, mostly for testing purposes. @@ -15,7 +15,7 @@ public interface RbacRoleRepository extends Repository { /** * @return all persistent RbacRoleEntity instances, assigned to the current subject (user or assumed roles) */ - List findAll(); + List findAll(); - RbacRoleRvEntity findByRoleName(String roleName); + RbacRoleEntity findByRoleName(String roleName); } diff --git a/src/main/resources/db/changelog/5-hs-office/510-membership/5103-hs-office-membership-rbac.md b/src/main/resources/db/changelog/5-hs-office/510-membership/5103-hs-office-membership-rbac.md index d458212c..3681b8e6 100644 --- a/src/main/resources/db/changelog/5-hs-office/510-membership/5103-hs-office-membership-rbac.md +++ b/src/main/resources/db/changelog/5-hs-office/510-membership/5103-hs-office-membership-rbac.md @@ -42,7 +42,7 @@ subgraph membership["`**membership**`"] role:membership:OWNER[[membership:OWNER]] role:membership:ADMIN[[membership:ADMIN]] - role:membership:REFERRER[[membership:REFERRER]] + role:membership:AGENT[[membership:AGENT]] end subgraph membership:permissions[ ] @@ -105,16 +105,16 @@ role:partnerRel.contact:ADMIN -.-> role:partnerRel:TENANT role:partnerRel:TENANT -.-> role:partnerRel.anchorPerson:REFERRER role:partnerRel:TENANT -.-> role:partnerRel.holderPerson:REFERRER role:partnerRel:TENANT -.-> role:partnerRel.contact:REFERRER -role:partnerRel:ADMIN ==> role:membership:OWNER role:membership:OWNER ==> role:membership:ADMIN -role:partnerRel:AGENT ==> role:membership:ADMIN -role:membership:ADMIN ==> role:membership:REFERRER -role:membership:REFERRER ==> role:partnerRel:TENANT +role:partnerRel:ADMIN ==> role:membership:ADMIN +role:membership:ADMIN ==> role:membership:AGENT +role:partnerRel:AGENT ==> role:membership:AGENT +role:membership:AGENT ==> role:partnerRel:TENANT %% granting permissions to roles role:global:ADMIN ==> perm:membership:INSERT -role:membership:OWNER ==> perm:membership:DELETE +role:membership:ADMIN ==> perm:membership:DELETE role:membership:ADMIN ==> perm:membership:UPDATE -role:membership:REFERRER ==> perm:membership:SELECT +role:membership:AGENT ==> perm:membership:SELECT ``` diff --git a/src/main/resources/db/changelog/5-hs-office/511-coopshares/5113-hs-office-coopshares-rbac.md b/src/main/resources/db/changelog/5-hs-office/511-coopshares/5113-hs-office-coopshares-rbac.md index 129de47c..26ff3d5c 100644 --- a/src/main/resources/db/changelog/5-hs-office/511-coopshares/5113-hs-office-coopshares-rbac.md +++ b/src/main/resources/db/changelog/5-hs-office/511-coopshares/5113-hs-office-coopshares-rbac.md @@ -54,7 +54,7 @@ subgraph membership["`**membership**`"] role:membership:OWNER[[membership:OWNER]] role:membership:ADMIN[[membership:ADMIN]] - role:membership:REFERRER[[membership:REFERRER]] + role:membership:AGENT[[membership:AGENT]] end end @@ -106,15 +106,15 @@ role:membership.partnerRel.contact:ADMIN -.-> role:membership.partnerRel:TENANT role:membership.partnerRel:TENANT -.-> role:membership.partnerRel.anchorPerson:REFERRER role:membership.partnerRel:TENANT -.-> role:membership.partnerRel.holderPerson:REFERRER role:membership.partnerRel:TENANT -.-> role:membership.partnerRel.contact:REFERRER -role:membership.partnerRel:ADMIN -.-> role:membership:OWNER role:membership:OWNER -.-> role:membership:ADMIN -role:membership.partnerRel:AGENT -.-> role:membership:ADMIN -role:membership:ADMIN -.-> role:membership:REFERRER -role:membership:REFERRER -.-> role:membership.partnerRel:TENANT +role:membership.partnerRel:ADMIN -.-> role:membership:ADMIN +role:membership:ADMIN -.-> role:membership:AGENT +role:membership.partnerRel:AGENT -.-> role:membership:AGENT +role:membership:AGENT -.-> role:membership.partnerRel:TENANT %% granting permissions to roles role:membership:ADMIN ==> perm:coopSharesTransaction:INSERT role:membership:ADMIN ==> perm:coopSharesTransaction:UPDATE -role:membership:ADMIN ==> perm:coopSharesTransaction:SELECT +role:membership:AGENT ==> perm:coopSharesTransaction:SELECT ``` diff --git a/src/main/resources/db/changelog/5-hs-office/511-coopshares/5113-hs-office-coopshares-rbac.sql b/src/main/resources/db/changelog/5-hs-office/511-coopshares/5113-hs-office-coopshares-rbac.sql index 1e894300..f4856f0a 100644 --- a/src/main/resources/db/changelog/5-hs-office/511-coopshares/5113-hs-office-coopshares-rbac.sql +++ b/src/main/resources/db/changelog/5-hs-office/511-coopshares/5113-hs-office-coopshares-rbac.sql @@ -38,7 +38,7 @@ begin SELECT * FROM hs_office_membership WHERE uuid = NEW.membershipUuid INTO newMembership; assert newMembership.uuid is not null, format('newMembership must not be null for NEW.membershipUuid = %s', NEW.membershipUuid); - call grantPermissionToRole(createPermission(NEW.uuid, 'SELECT'), hsOfficeMembershipADMIN(newMembership)); + call grantPermissionToRole(createPermission(NEW.uuid, 'SELECT'), hsOfficeMembershipAGENT(newMembership)); call grantPermissionToRole(createPermission(NEW.uuid, 'UPDATE'), hsOfficeMembershipADMIN(newMembership)); call leaveTriggerForObjectUuid(NEW.uuid); diff --git a/src/main/resources/db/changelog/5-hs-office/512-coopassets/5123-hs-office-coopassets-rbac.md b/src/main/resources/db/changelog/5-hs-office/512-coopassets/5123-hs-office-coopassets-rbac.md index 2b96a199..d220a38c 100644 --- a/src/main/resources/db/changelog/5-hs-office/512-coopassets/5123-hs-office-coopassets-rbac.md +++ b/src/main/resources/db/changelog/5-hs-office/512-coopassets/5123-hs-office-coopassets-rbac.md @@ -54,7 +54,7 @@ subgraph membership["`**membership**`"] role:membership:OWNER[[membership:OWNER]] role:membership:ADMIN[[membership:ADMIN]] - role:membership:REFERRER[[membership:REFERRER]] + role:membership:AGENT[[membership:AGENT]] end end @@ -106,15 +106,15 @@ role:membership.partnerRel.contact:ADMIN -.-> role:membership.partnerRel:TENANT role:membership.partnerRel:TENANT -.-> role:membership.partnerRel.anchorPerson:REFERRER role:membership.partnerRel:TENANT -.-> role:membership.partnerRel.holderPerson:REFERRER role:membership.partnerRel:TENANT -.-> role:membership.partnerRel.contact:REFERRER -role:membership.partnerRel:ADMIN -.-> role:membership:OWNER role:membership:OWNER -.-> role:membership:ADMIN -role:membership.partnerRel:AGENT -.-> role:membership:ADMIN -role:membership:ADMIN -.-> role:membership:REFERRER -role:membership:REFERRER -.-> role:membership.partnerRel:TENANT +role:membership.partnerRel:ADMIN -.-> role:membership:ADMIN +role:membership:ADMIN -.-> role:membership:AGENT +role:membership.partnerRel:AGENT -.-> role:membership:AGENT +role:membership:AGENT -.-> role:membership.partnerRel:TENANT %% granting permissions to roles role:membership:ADMIN ==> perm:coopAssetsTransaction:INSERT role:membership:ADMIN ==> perm:coopAssetsTransaction:UPDATE -role:membership:ADMIN ==> perm:coopAssetsTransaction:SELECT +role:membership:AGENT ==> perm:coopAssetsTransaction:SELECT ``` diff --git a/src/main/resources/db/changelog/5-hs-office/512-coopassets/5123-hs-office-coopassets-rbac.sql b/src/main/resources/db/changelog/5-hs-office/512-coopassets/5123-hs-office-coopassets-rbac.sql index 2c292436..df1fdd3b 100644 --- a/src/main/resources/db/changelog/5-hs-office/512-coopassets/5123-hs-office-coopassets-rbac.sql +++ b/src/main/resources/db/changelog/5-hs-office/512-coopassets/5123-hs-office-coopassets-rbac.sql @@ -38,7 +38,7 @@ begin SELECT * FROM hs_office_membership WHERE uuid = NEW.membershipUuid INTO newMembership; assert newMembership.uuid is not null, format('newMembership must not be null for NEW.membershipUuid = %s', NEW.membershipUuid); - call grantPermissionToRole(createPermission(NEW.uuid, 'SELECT'), hsOfficeMembershipADMIN(newMembership)); + call grantPermissionToRole(createPermission(NEW.uuid, 'SELECT'), hsOfficeMembershipAGENT(newMembership)); call grantPermissionToRole(createPermission(NEW.uuid, 'UPDATE'), hsOfficeMembershipADMIN(newMembership)); call leaveTriggerForObjectUuid(NEW.uuid); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/test/ContextBasedTestWithCleanup.java b/src/test/java/net/hostsharing/hsadminng/hs/office/test/ContextBasedTestWithCleanup.java index 1866f483..722fd87e 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/test/ContextBasedTestWithCleanup.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/test/ContextBasedTestWithCleanup.java @@ -6,7 +6,7 @@ import net.hostsharing.hsadminng.rbac.rbacgrant.RbacGrantEntity; import net.hostsharing.hsadminng.rbac.rbacgrant.RbacGrantRepository; import net.hostsharing.hsadminng.rbac.rbacgrant.RbacGrantsDiagramService; import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject; -import net.hostsharing.hsadminng.rbac.rbacrole.RbacRoleRvEntity; +import net.hostsharing.hsadminng.rbac.rbacrole.RbacRoleEntity; import net.hostsharing.hsadminng.rbac.rbacrole.RbacRoleRepository; import net.hostsharing.test.JpaAttempt; import org.jetbrains.annotations.NotNull; @@ -255,7 +255,7 @@ public abstract class ContextBasedTestWithCleanup extends ContextBasedTest { return jpaAttempt.transacted(() -> { context.define("superuser-alex@hostsharing.net", null); return rbacRoleRepo.findAll().stream() - .map(RbacRoleRvEntity::getRoleName) + .map(RbacRoleEntity::getRoleName) .collect(toSet()); }).assertSuccessful().returnedValue(); } diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleRepositoryIntegrationTest.java index d94382d7..4d873fa6 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleRepositoryIntegrationTest.java @@ -175,21 +175,21 @@ class RbacRoleRepositoryIntegrationTest { } } - void exactlyTheseRbacRolesAreReturned(final List actualResult, final String... expectedRoleNames) { + void exactlyTheseRbacRolesAreReturned(final List actualResult, final String... expectedRoleNames) { assertThat(actualResult) - .extracting(RbacRoleRvEntity::getRoleName) + .extracting(RbacRoleEntity::getRoleName) .containsExactlyInAnyOrder(expectedRoleNames); } - void allTheseRbacRolesAreReturned(final List actualResult, final String... expectedRoleNames) { + void allTheseRbacRolesAreReturned(final List actualResult, final String... expectedRoleNames) { assertThat(actualResult) - .extracting(RbacRoleRvEntity::getRoleName) + .extracting(RbacRoleEntity::getRoleName) .contains(expectedRoleNames); } - void noneOfTheseRbacRolesIsReturned(final List actualResult, final String... unexpectedRoleNames) { + void noneOfTheseRbacRolesIsReturned(final List actualResult, final String... unexpectedRoleNames) { assertThat(actualResult) - .extracting(RbacRoleRvEntity::getRoleName) + .extracting(RbacRoleEntity::getRoleName) .doesNotContain(unexpectedRoleNames); }