Class GroupUtils

java.lang.Object
org.keycloak.utils.GroupUtils

public class GroupUtils extends Object
  • 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 session
      realm - The realm to operate on
      groups - 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 from toRepresentation(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 - model
      representation - group representation
      Returns:
    • toRepresentation

      public static GroupRepresentation toRepresentation(GroupPermissionEvaluator groupsEvaluator, GroupModel groupTree, boolean full)