working hasGlobalAdminRole and prepare for Micrometer metrics with Spring Security #127

Merged
hsh-michaelhoennig merged 13 commits from feature/fix-hasGlobalAdminRole into master 2024-12-03 12:39:23 +01:00
Showing only changes of commit bfbe82b8f2 - Show all commits

View File

@ -38,27 +38,29 @@ class TestPackageRepositoryIntegrationTest extends ContextBasedTest {
class FindAllByOptionalNameLike { class FindAllByOptionalNameLike {
@Test @Test
public void globalAdmin_withoutAssumedRole_canNotViewAnyPackages_becauseThoseGrantsAreNotAssumed() { public void globalAdmin_withoutAssumedRole_canViewAllPackagesDueToBypassoOfRecursiveCteRbacQuery() {
// given // given
// alex is not just rbac.global-admin but lso the creating user, thus we use fran // alex is not just rbac.global-admin but also the creating user, thus we use fran
context.define("superuser-fran@hostsharing.net"); context.define("superuser-fran@hostsharing.net");
// when // when
final var result = testPackageRepository.findAllByOptionalNameLike(null); final var result = testPackageRepository.findAllByOptionalNameLike(null);
// then // then
noPackagesAreReturned(result);
exactlyThesePackagesAreReturned(result,
"xxx00", "xxx01", "xxx02", "yyy00", "yyy01", "yyy02", "zzz00", "zzz01", "zzz02");
} }
@Test @Test
public void globalAdmin_withAssumedglobalAdminRole__canNotViewAnyPackages_becauseThoseGrantsAreNotAssumed() { public void globalAdmin_withAssumedGlobalAdminRole__canNotViewAnyPackages_becauseThoseGrantsAreNotAssumed() {
given: // given
context.define("superuser-alex@hostsharing.net", "rbac.global#global:ADMIN"); context.define("superuser-alex@hostsharing.net", "rbac.global#global:ADMIN");
// when // when
final var result = testPackageRepository.findAllByOptionalNameLike(null); final var result = testPackageRepository.findAllByOptionalNameLike(null);
then: // then
noPackagesAreReturned(result); noPackagesAreReturned(result);
} }