Interface Authorizable

  • All Known Implementing Classes:
    AbstractAuthorizable, Group, User

    public interface Authorizable
    Interface which defines an authorizable: user / group
    • Method Detail

      • getId

        String getId()
        Get id of authorizable
        Returns:
        authorizableId
      • getHomePath

        String getHomePath()
        Get home path to authorizable
        Returns:
        path to authorizable
      • getHomeUrl

        String getHomeUrl()
        Get home URL to authorizable
        Returns:
        URL to authorizable
      • getRootPath

        String getRootPath()
        Get root path of the authorizable (user/group) in repository
        Returns:
        root path
      • exists

        boolean exists()
                throws org.apache.sling.testing.clients.ClientException,
                       InterruptedException
        Check if the authorizable exists
        Returns:
        true if the authorizable exists
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request failed
        InterruptedException - if interrupted
      • getJsonAsString

        String getJsonAsString​(String propsFilter,
                               int... expectedStatus)
                        throws org.apache.sling.testing.clients.ClientException
        String representation of authorizable http://localhost:4502/home/groups/default/administrators.rw.json?props=replication,modification,memberOf, membersTotal,members,profile/*&ml=2000
        Parameters:
        propsFilter - properties filter
        expectedStatus - list of allowed HTTP Status to be returned.
        Returns:
        the string representing a json
        Throws:
        org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
      • getUserPropertiesJsonAsString

        String getUserPropertiesJsonAsString​(int... expectedStatus)
                                      throws org.apache.sling.testing.clients.ClientException
        Get user properties JSON representation as string
        Parameters:
        expectedStatus - status to be
        Returns:
        user properties JSON representation as String
        Throws:
        org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
      • delete

        org.apache.sling.testing.clients.SlingHttpResponse delete​(int... expectedStatus)
                                                           throws org.apache.sling.testing.clients.ClientException
        Deletes an authorizable.
        Parameters:
        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
      • create

        <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
      • getMemberOf

        Map<String,​Authorizable> getMemberOf()
                                            throws org.apache.sling.testing.clients.ClientException,
                                                   InterruptedException
        Get members authorizable is assigned to.
        Returns:
        list of Authorizable
        Throws:
        org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
        InterruptedException - to mark this method as "waiting"
      • getMembers

        Map<String,​Authorizable> getMembers()
                                           throws org.apache.sling.testing.clients.ClientException,
                                                  InterruptedException
        Get members assigned to the authorizable.
        Returns:
        list of Authorizable
        Throws:
        org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
        InterruptedException - to mark this method as "waiting"
      • isImpersonated

        boolean isImpersonated()
                        throws org.apache.sling.testing.clients.ClientException
        Check if authorizable is impersonated.
        Returns:
        true if authorizable is impersonated.
        Throws:
        org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
      • getImpersonators

        Map<String,​Authorizable> getImpersonators()
                                                 throws org.apache.sling.testing.clients.ClientException,
                                                        InterruptedException
        Get impersonators of the authorizable.
        Returns:
        list of Authorizable
        Throws:
        org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
        InterruptedException - to mark this method as "waiting"
      • getProfile

        com.fasterxml.jackson.databind.JsonNode getProfile()
                                                    throws org.apache.sling.testing.clients.ClientException
        Get profile attributes for authorizable.
        Returns:
        JsonNode containing profile properties
        Throws:
        org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle