Package org.keycloak.utils
Class GroupUtils
java.lang.Object
org.keycloak.utils.GroupUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stream<GroupRepresentation>
populateGroupHierarchyFromSubGroups
(KeycloakSession session, RealmModel realm, Stream<GroupModel> groups, boolean full, GroupPermissionEvaluator groupEvaluator) This method takes the provided groups and attempts to load their parents all the way to the root group while maintaining the hierarchy data for each GroupRepresentation object.static GroupRepresentation
populateSubGroupCount
(GroupModel group, GroupRepresentation representation) This method's purpose is to look up the subgroup count of a Group and populate it on the representation.static GroupRepresentation
toRepresentation
(GroupPermissionEvaluator groupsEvaluator, GroupModel groupTree, boolean full)
-
Constructor Details
-
GroupUtils
public GroupUtils()
-
-
Method Details
-
populateGroupHierarchyFromSubGroups
public static Stream<GroupRepresentation> populateGroupHierarchyFromSubGroups(KeycloakSession session, RealmModel realm, Stream<GroupModel> groups, boolean full, GroupPermissionEvaluator groupEvaluator) This method takes the provided groups and attempts to load their parents all the way to the root group while maintaining the hierarchy data for each GroupRepresentation object. Each resultant GroupRepresentation object in the stream should contain relevant subgroups to the originally provided groups- Parameters:
session
- The active keycloak sessionrealm
- The realm to operate ongroups
- The groups that we want to populate the hierarchy for- Returns:
- A stream of groups that contain all relevant groups from the root down with no extra siblings
-
populateSubGroupCount
public static GroupRepresentation populateSubGroupCount(GroupModel group, GroupRepresentation representation) This method's purpose is to look up the subgroup count of a Group and populate it on the representation. This has been kept separate fromtoRepresentation(org.keycloak.services.resources.admin.permissions.GroupPermissionEvaluator, org.keycloak.models.GroupModel, boolean)
in order to keep database lookups separate from a function that aims to only convert objects A way of cohesively ensuring that a GroupRepresentation always has a group count should be considered- Parameters:
group
- modelrepresentation
- group representation- Returns:
-
toRepresentation
public static GroupRepresentation toRepresentation(GroupPermissionEvaluator groupsEvaluator, GroupModel groupTree, boolean full)
-