diff --git a/src/main/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantsDiagramService.java b/src/main/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantsDiagramService.java index 64a2d33e..6a15464d 100644 --- a/src/main/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantsDiagramService.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantsDiagramService.java @@ -94,12 +94,14 @@ public class RbacGrantsDiagramService { } public String allGrantsFrom(final UUID targetObject, final String op, final EnumSet includes) { - final var refUuid = (UUID) em.createNativeQuery("SELECT uuid FROM rbac.permission WHERE objectuuid=:targetObject AND op=:op") + final var graph = new LimitedHashSet(); + + @SuppressWarnings("unchecked") + final var refUuids = (List) em.createNativeQuery("SELECT uuid FROM rbac.permission WHERE objectuuid=:targetObject AND op=:op", List.class) .setParameter("targetObject", targetObject) .setParameter("op", op) - .getSingleResult(); - final var graph = new LimitedHashSet(); - traverseGrantsFrom(graph, refUuid, includes); + .getResultList(); + refUuids.forEach(refUuid -> traverseGrantsFrom(graph, refUuid, includes)); return toMermaidFlowchart(graph, includes); }