All Implemented Interfaces:
Authorizable

public class Group extends AbstractAuthorizable
Object which handles group actions
  • Field Details

  • Constructor Details

  • Method Details

    • getRootPath

      public String getRootPath()
      Description copied from interface: Authorizable
      Get root path of the authorizable (user/group) in repository
      Returns:
      root path
    • getGroupProfile

      public GroupProfile getGroupProfile() throws org.apache.sling.testing.clients.ClientException
      Get user profile
      Returns:
      GroupProfile
      Throws:
      org.apache.sling.testing.clients.ClientException - if the request failed
    • initProfile

      protected void initProfile() throws org.apache.sling.testing.clients.ClientException
      Throws:
      org.apache.sling.testing.clients.ClientException
    • addMembers

      public org.apache.sling.testing.clients.SlingHttpResponse addMembers(Authorizable[] authorizables, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Adds the group as member to other authorizables.
      Parameters:
      authorizables - array of any Authorizable
      expectedStatus - array of allowed HTTP Status to be returned.
      Returns:
      Sling response
      Throws:
      org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
    • addMember

      public org.apache.sling.testing.clients.SlingHttpResponse addMember(Authorizable authorizable, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Adds the group as member to another authorizable.
      Parameters:
      authorizable - any Authorizable
      expectedStatus - list of allowed HTTP Status to be returned.
      Returns:
      Sling response
      Throws:
      org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
    • removeMembers

      public org.apache.sling.testing.clients.SlingHttpResponse removeMembers(Authorizable[] authorizables, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Remove the group as member from other authorizables
      Parameters:
      authorizables - list of any Authorizable object
      expectedStatus - list of allowed HTTP Status to be returned.
      Returns:
      Sling response
      Throws:
      org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
    • hasGroupMember

      public boolean hasGroupMember(Authorizable authorizable) throws org.apache.sling.testing.clients.ClientException, InterruptedException
      Check if authorizable is member of a given group
      Parameters:
      authorizable - any Authorizable object
      Returns:
      true if authorizable is member of a given group
      Throws:
      org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
      InterruptedException - to mark this method as "waiting"
    • createGroup

      public static <T extends SecurityClient> Group createGroup(T client, String groupId, String intermediatePath, String givenName, String aboutMe, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException, InterruptedException
      Creates a new group.
      Type Parameters:
      T - client type
      Parameters:
      client - any class implementing the SecurityClient.
      groupId - the group ID for the new group.
      intermediatePath - the root path user will be created.
      givenName - the name of the group.
      aboutMe - description of the group.
      expectedStatus - list of allowed HTTP Status to be returned. If not set, http status 201 (CREATED) is assumed.
      Returns:
      Group
      Throws:
      org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
      InterruptedException - to mark this method as "waiting"