Class AuthorizableManager

    • Constructor Detail

      • AuthorizableManager

        public AuthorizableManager​(T client)
    • Method Detail

      • getGroupAdministrators

        public Group getGroupAdministrators()
                                     throws org.apache.sling.testing.clients.ClientException
        Get built-in group "administrators"
        Returns:
        administrators' Group
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request failed
      • getGroupContributor

        public Group getGroupContributor()
                                  throws org.apache.sling.testing.clients.ClientException
        Get built-in group "contributor"
        Returns:
        contributor' Group
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request failed
      • getGroupEveryone

        public Group getGroupEveryone()
                               throws org.apache.sling.testing.clients.ClientException
        Get built-in group "everyone"
        Returns:
        everyone' Group
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request failed
      • getGroupUserAdministrators

        public Group getGroupUserAdministrators()
                                         throws org.apache.sling.testing.clients.ClientException
        Get built-in group "user-administrators"
        Returns:
        user-administrators' Group
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request failed
      • getUser

        public User getUser​(String userId)
                     throws org.apache.sling.testing.clients.ClientException
        Get an existing user object from the id.
        Parameters:
        userId - the user ID.
        Returns:
        User
        Throws:
        org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
      • getGroup

        public Group getGroup​(String groupId)
                       throws org.apache.sling.testing.clients.ClientException
        Get an existing group object from the id.
        Parameters:
        groupId - the group ID.
        Returns:
        Group
        Throws:
        org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
      • create

        public <T extends SecurityClientAuthorizable create​(T client,
                                                              Class<? extends AbstractAuthorizable> authorizableClass,
                                                              String authorizableId,
                                                              org.apache.sling.testing.clients.util.FormEntityBuilder formParameters,
                                                              int... expectedStatus)
                                                       throws org.apache.sling.testing.clients.ClientException
        Creates a new Authorizable.
        Type Parameters:
        T - client type
        Parameters:
        client - any class implementing the SecurityClient.
        authorizableClass - Authorizable class to be created.
        authorizableId - the ID for the new authorizable.
        formParameters - form parameters.
        expectedStatus - list of allowed HTTP Status to be returned. If not set, http status 201 (CREATED) is assumed.
        Returns:
        created Authorizable
        Throws:
        org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
      • getAuthorizable

        protected <T extends AbstractAuthorizable> T getAuthorizable​(Class<T> authorizableClass,
                                                                     String authorizableId)
                                                              throws org.apache.sling.testing.clients.ClientException
        Get an instance of any class extending AbstractAuthorizable with given ID. Home path for authorizable is assumed in default structure.

        Type Parameters:
        T - any class extending AbstractAuthorizable
        Parameters:
        authorizableClass - any class extending the AbstractAuthorizable
        authorizableId - the authorizable ID.
        Returns:
        the client
        Throws:
        org.apache.sling.testing.clients.ClientException - if client can't be instantiated
      • getAuthorizables

        public List<Authorizable> getAuthorizables​(String query)
                                            throws org.apache.sling.testing.clients.ClientException
        Get all authorizables from Json as list of Authorizables.
        Parameters:
        query - search query for authorizables
        Returns:
        authorizables as Authorizable
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request failed
      • getAuthorizablesJson

        public String getAuthorizablesJson​(String query)
                                    throws org.apache.sling.testing.clients.ClientException
        Get all authorizables as json String.
        Parameters:
        query - search query for authorizables
        Returns:
        authorizables as JSON String
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request failed
      • doPost

        public org.apache.sling.testing.clients.SlingHttpResponse doPost​(org.apache.sling.testing.clients.util.FormEntityBuilder formParameters,
                                                                         int... expectedStatus)
                                                                  throws org.apache.sling.testing.clients.ClientException
        POST request to AuthorizableServlet.
        Parameters:
        formParameters - form parameters.
        expectedStatus - list of allowed HTTP Status to be returned.
        Returns:
        executed request
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request failed