Upgrade to SpringBoot 3.4.1 and dependencies #147
@ -49,8 +49,18 @@ public class RbacGrantsDiagramService {
|
||||
NON_TEST_ENTITIES;
|
||||
|
||||
public static final EnumSet<Include> ALL = EnumSet.allOf(Include.class);
|
||||
public static final EnumSet<Include> ALL_TEST_ENTITY_RELATED = EnumSet.of(USERS, DETAILS, NOT_ASSUMED, TEST_ENTITIES, PERMISSIONS);
|
||||
public static final EnumSet<Include> ALL_NON_TEST_ENTITY_RELATED = EnumSet.of(USERS, DETAILS, NOT_ASSUMED, NON_TEST_ENTITIES, PERMISSIONS);
|
||||
public static final EnumSet<Include> ALL_TEST_ENTITY_RELATED = EnumSet.of(
|
||||
USERS,
|
||||
DETAILS,
|
||||
NOT_ASSUMED,
|
||||
TEST_ENTITIES,
|
||||
PERMISSIONS);
|
||||
public static final EnumSet<Include> ALL_NON_TEST_ENTITY_RELATED = EnumSet.of(
|
||||
USERS,
|
||||
DETAILS,
|
||||
NOT_ASSUMED,
|
||||
NON_TEST_ENTITIES,
|
||||
PERMISSIONS);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@ -96,12 +106,15 @@ public class RbacGrantsDiagramService {
|
||||
public String allGrantsFrom(final UUID targetObject, final String op, final EnumSet<Include> includes) {
|
||||
final var graph = new LimitedHashSet<RawRbacGrantEntity>();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
final var refUuids = (List<UUID>) em.createNativeQuery("SELECT uuid FROM rbac.permission WHERE objectuuid=:targetObject AND op=:op", List.class)
|
||||
@SuppressWarnings("unchecked") // List -> List<List<UUID>>
|
||||
final var refUuidLists = (List<List<UUID>>) em.createNativeQuery(
|
||||
"select uuid from rbac.permission where objectUuid=:targetObject and op=:op",
|
||||
List.class)
|
||||
.setParameter("targetObject", targetObject)
|
||||
.setParameter("op", op)
|
||||
.getResultList();
|
||||
refUuids.forEach(refUuid -> traverseGrantsFrom(graph, refUuid, includes));
|
||||
refUuidLists.stream().flatMap(Collection::stream)
|
||||
.forEach(refUuid -> traverseGrantsFrom(graph, refUuid, includes));
|
||||
return toMermaidFlowchart(graph, includes);
|
||||
}
|
||||
|
||||
@ -217,10 +230,15 @@ public class RbacGrantsDiagramService {
|
||||
@NotNull
|
||||
private static String cleanId(final String idName) {
|
||||
return idName.replaceAll("@.*", "")
|
||||
.replace("[", "").replace("]", "").replace("(", "").replace(")", "").replace(",", "").replace(">", ":").replace("|", "_");
|
||||
.replace("[", "")
|
||||
.replace("]", "")
|
||||
.replace("(", "")
|
||||
.replace(")", "")
|
||||
.replace(",", "")
|
||||
.replace(">", ":")
|
||||
.replace("|", "_");
|
||||
}
|
||||
|
||||
|
||||
static class LimitedHashSet<T> extends HashSet<T> {
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user