From 5310b72400de1047319882bef99f2aba692f5ffc Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Tue, 2 Apr 2024 12:16:05 +0200 Subject: [PATCH] Merge remote-tracking branch 'origin/master' into debitornumbersuffix-as-string # Conflicts: # README.md # doc/rbac.md # src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntity.java # src/main/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionEntity.java # src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntity.java # src/main/resources/db/changelog/1-rbac/1080-rbac-global.sql # src/main/resources/db/changelog/133-test-domain-rbac.md # src/main/resources/db/changelog/223-hs-office-relation-rbac.md # src/main/resources/db/changelog/233-hs-office-partner-rbac.md # src/main/resources/db/changelog/253-hs-office-sepamandate-rbac.md # src/main/resources/db/changelog/273-hs-office-debitor-rbac.md # src/main/resources/db/changelog/303-hs-office-membership-rbac.md # src/main/resources/db/changelog/313-hs-office-coopshares-rbac.md # src/main/resources/db/changelog/313-hs-office-coopshares-rbac.sql # src/main/resources/db/changelog/323-hs-office-coopassets-rbac.md # src/main/resources/db/changelog/323-hs-office-coopassets-rbac.sql # src/main/resources/db/changelog/5-hs-office/510-membership/5103-hs-office-membership-rbac.sql # src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionRepositoryIntegrationTest.java # src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionRepositoryIntegrationTest.java # src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipControllerAcceptanceTest.java # src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipRepositoryIntegrationTest.java # src/test/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantControllerAcceptanceTest.java # src/test/java/net/hostsharing/hsadminng/rbac/rbacrole/TestRbacRole.java --- .../rbac/rbacrole/RbacRoleController.java | 2 +- ...acRoleRvEntity.java => RbacRoleEntity.java} | 2 +- .../rbac/rbacrole/RbacRoleRepository.java | 6 +++--- .../test/ContextBasedTestWithCleanup.java | 4 ++-- .../RbacGrantControllerAcceptanceTest.java | 18 +++++++++--------- .../RbacRoleRepositoryIntegrationTest.java | 12 ++++++------ .../hsadminng/rbac/rbacrole/TestRbacRole.java | 10 +++++----- 7 files changed, 27 insertions(+), 27 deletions(-) rename src/main/java/net/hostsharing/hsadminng/rbac/rbacrole/{RbacRoleRvEntity.java => RbacRoleEntity.java} (96%) 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/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/rbacgrant/RbacGrantControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantControllerAcceptanceTest.java index 9b6bb3a9..15738504 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantControllerAcceptanceTest.java @@ -5,7 +5,7 @@ import io.restassured.http.ContentType; import io.restassured.response.ValidatableResponse; import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.context.ContextBasedTest; -import net.hostsharing.hsadminng.rbac.rbacrole.RbacRoleRvEntity; +import net.hostsharing.hsadminng.rbac.rbacrole.RbacRoleEntity; import net.hostsharing.hsadminng.rbac.rbacrole.RbacRoleRepository; import net.hostsharing.hsadminng.rbac.rbacuser.RbacUserEntity; import net.hostsharing.hsadminng.rbac.rbacuser.RbacUserRepository; @@ -361,11 +361,11 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { this(currentUser, ""); } - GrantFixture grantsRole(final RbacRoleRvEntity givenOwnPackageAdminRole) { + GrantFixture grantsRole(final RbacRoleEntity givenOwnPackageAdminRole) { return new GrantFixture(givenOwnPackageAdminRole); } - RevokeFixture revokesRole(final RbacRoleRvEntity givenOwnPackageAdminRole) { + RevokeFixture revokesRole(final RbacRoleEntity givenOwnPackageAdminRole) { return new RevokeFixture(givenOwnPackageAdminRole); } @@ -376,11 +376,11 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { class GrantFixture { private Subject grantingSubject = Subject.this; - private final RbacRoleRvEntity grantedRole; + private final RbacRoleEntity grantedRole; private boolean assumed; private RbacUserEntity granteeUser; - public GrantFixture(final RbacRoleRvEntity roleToGrant) { + public GrantFixture(final RbacRoleEntity roleToGrant) { this.grantedRole = roleToGrant; } @@ -417,11 +417,11 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { class RevokeFixture { private Subject currentSubject = Subject.this; - private final RbacRoleRvEntity grantedRole; + private final RbacRoleEntity grantedRole; private boolean assumed; private RbacUserEntity granteeUser; - public RevokeFixture(final RbacRoleRvEntity roleToGrant) { + public RevokeFixture(final RbacRoleEntity roleToGrant) { this.grantedRole = roleToGrant; } @@ -455,9 +455,9 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { private class GetGrantByIdFixture { private Subject currentSubject = Subject.this; - private RbacRoleRvEntity grantedRole; + private RbacRoleEntity grantedRole; - GetGrantByIdFixture forGrantedRole(final RbacRoleRvEntity grantedRole) { + GetGrantByIdFixture forGrantedRole(final RbacRoleEntity grantedRole) { this.grantedRole = grantedRole; return this; } 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); } diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/rbacrole/TestRbacRole.java b/src/test/java/net/hostsharing/hsadminng/rbac/rbacrole/TestRbacRole.java index 9eb0f3c7..73e30a1b 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/rbacrole/TestRbacRole.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/rbacrole/TestRbacRole.java @@ -4,11 +4,11 @@ import static java.util.UUID.randomUUID; public class TestRbacRole { - public static final RbacRoleRvEntity hostmasterRole = rbacRole("global", "global", RbacRoleType.ADMIN); - static final RbacRoleRvEntity customerXxxOwner = rbacRole("test_customer", "xxx", RbacRoleType.OWNER); - static final RbacRoleRvEntity customerXxxAdmin = rbacRole("test_customer", "xxx", RbacRoleType.ADMIN); + public static final RbacRoleEntity hostmasterRole = rbacRole("global", "global", RbacRoleType.ADMIN); + static final RbacRoleEntity customerXxxOwner = rbacRole("test_customer", "xxx", RbacRoleType.OWNER); + static final RbacRoleEntity customerXxxAdmin = rbacRole("test_customer", "xxx", RbacRoleType.ADMIN); - static public RbacRoleRvEntity rbacRole(final String objectTable, final String objectIdName, final RbacRoleType roleType) { - return new RbacRoleRvEntity(randomUUID(), randomUUID(), objectTable, objectIdName, roleType, objectTable+'#'+objectIdName+':'+roleType); + static public RbacRoleEntity rbacRole(final String objectTable, final String objectIdName, final RbacRoleType roleType) { + return new RbacRoleEntity(randomUUID(), randomUUID(), objectTable, objectIdName, roleType, objectTable+'#'+objectIdName+':'+roleType); } }