always generate dynacmi RBAC to doc/temp with explicit name

This commit is contained in:
Michael Hoennig 2024-04-08 08:38:31 +02:00
parent 56f316ef80
commit 5051198e00
3 changed files with 4 additions and 9 deletions

View File

@ -209,7 +209,7 @@ public class RbacGrantsDiagramService {
}
class LimitedHashSet<T> extends HashSet<T> {
static class LimitedHashSet<T> extends HashSet<T> {
@Override
public boolean add(final T t) {

View File

@ -5,7 +5,6 @@ import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRepository;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository;
import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup;
import net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantRepository;
import net.hostsharing.hsadminng.rbac.rbacgrant.RbacGrantsDiagramService;
import net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleRepository;
import net.hostsharing.test.Array;
import net.hostsharing.test.JpaAttempt;
@ -295,8 +294,6 @@ class HsOfficeRelationRepositoryIntegrationTest extends ContextBasedTestWithClea
}
private void assertThatRelationActuallyInDatabase(final HsOfficeRelationEntity saved) {
generateRbacDiagramForCurrentSubjects(RbacGrantsDiagramService.Include.ALL_NON_TEST_ENTITY_RELATED);
generateRbacDiagramForObjectPermission(saved.getUuid(), "SELECT", "relation-select");
final var found = relationRepo.findByUuid(saved.getUuid());
assertThat(found).isNotEmpty().get().isNotSameAs(saved).usingRecursiveComparison().isEqualTo(saved);
}

View File

@ -17,7 +17,6 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import jakarta.persistence.*;
import java.lang.reflect.Method;
import java.util.*;
import static java.lang.System.out;
@ -272,12 +271,11 @@ public abstract class ContextBasedTestWithCleanup extends ContextBasedTest {
/**
* Generates a diagram of the RBAC-Grants to the current subjects (user or assumed roles).
*/
protected void generateRbacDiagramForCurrentSubjects(final EnumSet<RbacGrantsDiagramService.Include> include) {
final var title = testInfo.getTestMethod().map(Method::getName).orElseThrow();
protected void generateRbacDiagramForCurrentSubjects(final EnumSet<RbacGrantsDiagramService.Include> include, final String name) {
RbacGrantsDiagramService.writeToFile(
title,
name,
diagramService.allGrantsToCurrentUser(include),
"doc/" + title + ".md"
"doc/temp/" + name + ".md"
);
}