Interface Authorizable
-
@ProviderType public interface AuthorizableThe Authorizable is the common base interface forUserandGroup. It provides access to thePrincipals associated with anAuthorizable(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
AuthorizableandPrincipal:
AnAuthorizableis repository object that is neither associated with nor depending from a particularSessionand thus independent of the login mechanisms creatingSessions.
On the other hand
Principals are representations of user identities. In other words: eachPrincipalwithin the set associated with the Session's Subject upon login represents an identity for that user. An the set ofPrincipals 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:
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull java.util.Iterator<Group>declaredMemberOf()@NotNull java.lang.StringgetID()Return the implementation specific identifier for thisAuthorizable.@NotNull java.lang.StringgetPath()Returns a JCR path if this authorizable instance is associated with an item that can be accessed by the editingSession.@NotNull java.security.PrincipalgetPrincipal()@Nullable javax.jcr.Value[]getProperty(@NotNull java.lang.String relPath)Returns the values for the properties with the specified name ornull.@NotNull java.util.Iterator<java.lang.String>getPropertyNames()Returns the names of properties present withthisAuthorizable not taking possible relative paths into consideration.@NotNull java.util.Iterator<java.lang.String>getPropertyNames(@NotNull java.lang.String relPath)Returns the names of properties present withthisAuthorizable at the specified relative path.booleanhasProperty(@NotNull java.lang.String relPath)Tests if a the property with specified name exists.booleanisGroup()@NotNull java.util.Iterator<Group>memberOf()voidremove()Removes thisAuthorizable, if the session has sufficient permissions.booleanremoveProperty(@NotNull java.lang.String relPath)Removes the property with the given name.voidsetProperty(@NotNull java.lang.String relPath, @Nullable javax.jcr.Value value)Set an arbitrary property to thisAuthorizable.voidsetProperty(@NotNull java.lang.String relPath, @Nullable javax.jcr.Value[] value)Set an arbitrary property to thisAuthorizable.
-
-
-
Method Detail
-
getID
@NotNull @NotNull java.lang.String getID() throws javax.jcr.RepositoryExceptionReturn the implementation specific identifier for thisAuthorizable. It could e.g. be a UserID or simply the principal name.- Returns:
- Name of this
Authorizable. - Throws:
javax.jcr.RepositoryException- if an error occurs.
-
isGroup
boolean isGroup()
- Returns:
- if the current Authorizable is a
Group
-
getPrincipal
@NotNull @NotNull java.security.Principal getPrincipal() throws javax.jcr.RepositoryException- Returns:
- a representation as Principal.
- Throws:
javax.jcr.RepositoryException- If an error occurs.
-
declaredMemberOf
@NotNull @NotNull java.util.Iterator<Group> declaredMemberOf() throws javax.jcr.RepositoryException
- Returns:
- all
Groups, this Authorizable is declared member of. - Throws:
javax.jcr.RepositoryException- If an error occurs.
-
memberOf
@NotNull @NotNull java.util.Iterator<Group> memberOf() throws javax.jcr.RepositoryException
- Returns:
- all
Groups, this Authorizable is member of included indirect group membership. - Throws:
javax.jcr.RepositoryException- If an error occurs.
-
remove
void remove() throws javax.jcr.RepositoryExceptionRemoves thisAuthorizable, if the session has sufficient permissions. Note, that removing anAuthorizableeven if it listed as member of a Group or if still has members (this is a Group itself).- Throws:
javax.jcr.RepositoryException- If an error occurred and theAuthorizablecould not be removed.
-
getPropertyNames
@NotNull @NotNull java.util.Iterator<java.lang.String> getPropertyNames() throws javax.jcr.RepositoryExceptionReturns the names of properties present withthisAuthorizable not taking possible relative paths into consideration. Same asgetPropertyNames(String)where the specified string is ".".- Returns:
- names of properties.
- Throws:
javax.jcr.RepositoryException- If an error occurs.- See Also:
where the specified relative path is simply an name.,hasProperty(String)
-
getPropertyNames
@NotNull @NotNull java.util.Iterator<java.lang.String> getPropertyNames(@NotNull @NotNull java.lang.String relPath) throws javax.jcr.RepositoryExceptionReturns the names of properties present withthisAuthorizable at the specified relative path.- Parameters:
relPath- A relative path.- Returns:
- names of properties.
- Throws:
javax.jcr.RepositoryException- If an error occurs.- See Also:
getProperty(String),hasProperty(String)
-
hasProperty
boolean hasProperty(@NotNull @NotNull java.lang.String relPath) throws javax.jcr.RepositoryExceptionTests if a the property with specified name exists.- Parameters:
relPath- The relative path to the property to be tested.- Returns:
trueif a property with the given name exists.- Throws:
javax.jcr.RepositoryException- If an error occurs.- See Also:
getProperty(String)
-
setProperty
void setProperty(@NotNull @NotNull java.lang.String relPath, @Nullable @Nullable javax.jcr.Value value) throws javax.jcr.RepositoryExceptionSet an arbitrary property to thisAuthorizable.- Parameters:
relPath- The relative path of the property to be added or modified.value- The desired value.- Throws:
javax.jcr.RepositoryException- If the specified property could not be set.
-
setProperty
void setProperty(@NotNull @NotNull java.lang.String relPath, @Nullable @Nullable javax.jcr.Value[] value) throws javax.jcr.RepositoryExceptionSet an arbitrary property to thisAuthorizable.- Parameters:
relPath- The relative path of the property to be added or modified.value- The desired property values.- Throws:
javax.jcr.RepositoryException- If the specified property could not be set.
-
getProperty
@Nullable @Nullable javax.jcr.Value[] getProperty(@NotNull @NotNull java.lang.String relPath) throws javax.jcr.RepositoryExceptionReturns the values for the properties with the specified name ornull.- Parameters:
relPath- Relative path of the property to be retrieved.- Returns:
- value of the property with the given name or
nullif no such property exists. - Throws:
javax.jcr.RepositoryException- If an error occurs.
-
removeProperty
boolean removeProperty(@NotNull @NotNull java.lang.String relPath) throws javax.jcr.RepositoryExceptionRemoves 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:
javax.jcr.RepositoryException- If an error occurs.
-
getPath
@NotNull @NotNull java.lang.String getPath() throws javax.jcr.UnsupportedRepositoryOperationException, javax.jcr.RepositoryExceptionReturns a JCR path if this authorizable instance is associated with an item that can be accessed by the editingSession.Throws
UnsupportedRepositoryOperationExceptionif this method is not supported or if there is no item associated with this authorizable that is accessible by the editingSession.Throws
RepositoryExceptionif another error occurs while retrieving the path.- Returns:
- the path of the
Itemthat corresponds to thisAuthorizable. - Throws:
javax.jcr.UnsupportedRepositoryOperationException- If this method is not supported or if there exists no accessible item associated with thisAuthorizableinstance.javax.jcr.RepositoryException- If an error occurs while retrieving theItempath.
-
-