Interface Authorizable

All Known Subinterfaces:
Group, User

@ProviderType public interface Authorizable
The Authorizable is the common base interface for User and Group. It provides access to the Principals associated with an Authorizable (see below) and allow to access and modify additional properties such as e.g. full name, e-mail or address.

Please note the difference between Authorizable and Principal:
An Authorizable is repository object that is neither associated with nor depending from a particular Session and thus independent of the login mechanisms creating Sessions.

On the other hand Principals are representations of user identities. In other words: each Principal within the set associated with the Session's Subject upon login represents an identity for that user. An the set of Principals may differ between different login mechanisms.

Consequently an one-to-many relationship exists between Authorizable and Principal (see also getPrincipal().

The interfaces derived from Authorizable are defined as follows:

  • User: defined to be an Authorizable that can be authenticated (by using Credentials) and impersonated.
  • Group: defined to be a collection of other Authorizables.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull Iterator<Group>
     
    @NotNull String
    Return the implementation specific identifier for this Authorizable.
    @NotNull String
    Returns a JCR path if this authorizable instance is associated with an item that can be accessed by the editing Session.
    @NotNull Principal
     
    @Nullable Value[]
    getProperty(@NotNull String relPath)
    Returns the values for the properties with the specified name or null.
    @NotNull Iterator<String>
    Returns the names of properties present with this Authorizable not taking possible relative paths into consideration.
    @NotNull Iterator<String>
    getPropertyNames(@NotNull String relPath)
    Returns the names of properties present with this Authorizable at the specified relative path.
    boolean
    hasProperty(@NotNull String relPath)
    Tests if a the property with specified name exists.
    boolean
     
    @NotNull Iterator<Group>
     
    void
    Removes this Authorizable, if the session has sufficient permissions.
    boolean
    removeProperty(@NotNull String relPath)
    Removes the property with the given name.
    void
    setProperty(@NotNull String relPath, @Nullable Value value)
    Set an arbitrary property to this Authorizable.
    void
    setProperty(@NotNull String relPath, @Nullable Value[] value)
    Set an arbitrary property to this Authorizable.
  • Method Details

    • getID

      @NotNull @NotNull String getID() throws RepositoryException
      Return the implementation specific identifier for this Authorizable. It could e.g. be a UserID or simply the principal name.
      Returns:
      Name of this Authorizable.
      Throws:
      RepositoryException - if an error occurs.
    • isGroup

      boolean isGroup()
      Returns:
      if the current Authorizable is a Group
    • getPrincipal

      @NotNull @NotNull Principal getPrincipal() throws RepositoryException
      Returns:
      a representation as Principal.
      Throws:
      RepositoryException - If an error occurs.
    • declaredMemberOf

      @NotNull @NotNull Iterator<Group> declaredMemberOf() throws RepositoryException
      Returns:
      all Groups, this Authorizable is declared member of.
      Throws:
      RepositoryException - If an error occurs.
    • memberOf

      @NotNull @NotNull Iterator<Group> memberOf() throws RepositoryException
      Returns:
      all Groups, this Authorizable is member of included indirect group membership.
      Throws:
      RepositoryException - If an error occurs.
    • remove

      void remove() throws RepositoryException
      Removes this Authorizable, if the session has sufficient permissions. Note, that removing an Authorizable even if it listed as member of a Group or if still has members (this is a Group itself).
      Throws:
      RepositoryException - If an error occurred and the Authorizable could not be removed.
    • getPropertyNames

      @NotNull @NotNull Iterator<String> getPropertyNames() throws RepositoryException
      Returns the names of properties present with this Authorizable not taking possible relative paths into consideration. Same as getPropertyNames(String) where the specified string is ".".
      Returns:
      names of properties.
      Throws:
      RepositoryException - If an error occurs.
      See Also:
    • getPropertyNames

      @NotNull @NotNull Iterator<String> getPropertyNames(@NotNull @NotNull String relPath) throws RepositoryException
      Returns the names of properties present with this Authorizable at the specified relative path.
      Parameters:
      relPath - A relative path.
      Returns:
      names of properties.
      Throws:
      RepositoryException - If an error occurs.
      See Also:
    • hasProperty

      boolean hasProperty(@NotNull @NotNull String relPath) throws RepositoryException
      Tests if a the property with specified name exists.
      Parameters:
      relPath - The relative path to the property to be tested.
      Returns:
      true if a property with the given name exists.
      Throws:
      RepositoryException - If an error occurs.
      See Also:
    • setProperty

      void setProperty(@NotNull @NotNull String relPath, @Nullable @Nullable Value value) throws RepositoryException
      Set an arbitrary property to this Authorizable.
      Parameters:
      relPath - The relative path of the property to be added or modified.
      value - The desired value.
      Throws:
      RepositoryException - If the specified property could not be set.
    • setProperty

      void setProperty(@NotNull @NotNull String relPath, @Nullable @Nullable Value[] value) throws RepositoryException
      Set an arbitrary property to this Authorizable.
      Parameters:
      relPath - The relative path of the property to be added or modified.
      value - The desired property values.
      Throws:
      RepositoryException - If the specified property could not be set.
    • getProperty

      @Nullable @Nullable Value[] getProperty(@NotNull @NotNull String relPath) throws RepositoryException
      Returns the values for the properties with the specified name or null.
      Parameters:
      relPath - Relative path of the property to be retrieved.
      Returns:
      value of the property with the given name or null if no such property exists.
      Throws:
      RepositoryException - If an error occurs.
    • removeProperty

      boolean removeProperty(@NotNull @NotNull String relPath) throws RepositoryException
      Removes the property with the given name.
      Parameters:
      relPath - Relative path (or name) of the property to be removed.
      Returns:
      true If the property at the specified relPath was successfully removed; false if no such property was present.
      Throws:
      RepositoryException - If an error occurs.
    • getPath

      Returns a JCR path if this authorizable instance is associated with an item that can be accessed by the editing Session.

      Throws UnsupportedRepositoryOperationException if this method is not supported or if there is no item associated with this authorizable that is accessible by the editing Session.

      Throws RepositoryException if another error occurs while retrieving the path.

      Returns:
      the path of the Item that corresponds to this Authorizable.
      Throws:
      UnsupportedRepositoryOperationException - If this method is not supported or if there exists no accessible item associated with this Authorizable instance.
      RepositoryException - If an error occurs while retrieving the Item path.