there can be multiple INSERT permissions for a single targetObject

This commit is contained in:
Michael Hoennig 2025-01-14 11:33:13 +01:00
parent c56d06072a
commit d98c8ef8d3

View File

@ -94,12 +94,14 @@ public class RbacGrantsDiagramService {
} }
public String allGrantsFrom(final UUID targetObject, final String op, final EnumSet<Include> includes) { public String allGrantsFrom(final UUID targetObject, final String op, final EnumSet<Include> includes) {
final var refUuid = (UUID) em.createNativeQuery("SELECT uuid FROM rbac.permission WHERE objectuuid=:targetObject AND op=:op") 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)
.setParameter("targetObject", targetObject) .setParameter("targetObject", targetObject)
.setParameter("op", op) .setParameter("op", op)
.getSingleResult(); .getResultList();
final var graph = new LimitedHashSet<RawRbacGrantEntity>(); refUuids.forEach(refUuid -> traverseGrantsFrom(graph, refUuid, includes));
traverseGrantsFrom(graph, refUuid, includes);
return toMermaidFlowchart(graph, includes); return toMermaidFlowchart(graph, includes);
} }