org.apache.jackrabbit.core.security.user
Class UserImpl

java.lang.Object
  extended by org.apache.jackrabbit.core.security.user.UserImpl
All Implemented Interfaces:
Authorizable, User

public class UserImpl
extends Object
implements User

UserImpl


Field Summary
static String AUTHORIZABLES_PATH
           
static String GROUP_ADMIN_GROUP_NAME
          Configuration key and default value for the the name of the 'GroupAdmin' group-principal
static String GROUPS_PATH
           
static Name MIX_REP_IMPERSONATABLE
           
static Name N_MEMBERS
           
static NameFactory NF
           
static Name NT_REP_AUTHORIZABLE
           
static Name NT_REP_AUTHORIZABLE_FOLDER
           
static Name NT_REP_GROUP
           
static Name NT_REP_MEMBERS
           
static Name NT_REP_USER
           
static Name P_DISABLED
           
static Name P_GROUPS
          Deprecated. As of 2.0 group membership is stored with the group node.
static Name P_IMPERSONATORS
          Name of the user property containing the principal names of those allowed to impersonate.
static Name P_MEMBERS
           
static Name P_PASSWORD
           
static Name P_PRINCIPAL_NAME
           
static Name P_USERID
          Deprecated. As of 2.0 the id-hash is stored with the jcr:uuid making the rep:userId property redundant. It has been removed from the node type definition.
static String SECURITY_ROOT_PATH
          root-path to security related content e.g. principals
static String USER_ADMIN_GROUP_NAME
          Configuration key and default value for the the name of the 'UserAdmin' group-principal.
static String USERS_PATH
           
 
Constructor Summary
protected UserImpl(NodeImpl node, UserManagerImpl userManager)
           
 
Method Summary
 void changePassword(String password)
          Change the password of this user.
 Iterator<Group> declaredMemberOf()
           
 void disable(String reason)
          Disable this user thus preventing future login if the reason is a non-null String.
 boolean equals(Object obj)
           
 Credentials getCredentials()
          Returns the internal Credentials representation for this user.
 String getDisabledReason()
          Returns the String specified upon disabling this user or null if User.isDisabled() returns false.
 String getID()
          Returns the unescaped name of the node that defines this Authorizable.
 Impersonation getImpersonation()
           
 Principal getPrincipal()
           
 Value[] getProperty(String relPath)
          Returns the values for the properties with the specified name or null.
 Iterator<String> getPropertyNames()
          Returns the names of properties present with this Authorizable not taking possible relative paths into consideration.
 Iterator<String> getPropertyNames(String relPath)
          Returns the names of properties present with this Authorizable at the specified relative path.
 int hashCode()
           
 boolean hasProperty(String relPath)
          Tests if a the property with specified name exists.
 boolean isAdmin()
           
 boolean isDisabled()
          Returns true if this user is disabled, false otherwise.
 boolean isGroup()
           
 Iterator<Group> memberOf()
           
 void remove()
          Removes this Authorizable, if the session has sufficient permissions.
 boolean removeProperty(String relPath)
          Removes the property with the given name.
 void setProperty(String relPath, Value value)
          Sets the Value for the given name.
 void setProperty(String relPath, Value[] values)
          Sets the Value[] for the given name.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.jackrabbit.api.security.user.Authorizable
declaredMemberOf, getID, getProperty, getPropertyNames, getPropertyNames, hasProperty, memberOf, remove, removeProperty, setProperty, setProperty
 

Field Detail

NF

public static final NameFactory NF

SECURITY_ROOT_PATH

public static final String SECURITY_ROOT_PATH
root-path to security related content e.g. principals

See Also:
Constant Field Values

AUTHORIZABLES_PATH

public static final String AUTHORIZABLES_PATH
See Also:
Constant Field Values

USERS_PATH

public static final String USERS_PATH
See Also:
Constant Field Values

GROUPS_PATH

public static final String GROUPS_PATH
See Also:
Constant Field Values

USER_ADMIN_GROUP_NAME

public static final String USER_ADMIN_GROUP_NAME
Configuration key and default value for the the name of the 'UserAdmin' group-principal.

See Also:
Constant Field Values

GROUP_ADMIN_GROUP_NAME

public static final String GROUP_ADMIN_GROUP_NAME
Configuration key and default value for the the name of the 'GroupAdmin' group-principal

See Also:
Constant Field Values

P_PRINCIPAL_NAME

public static final Name P_PRINCIPAL_NAME

P_USERID

public static final Name P_USERID
Deprecated. As of 2.0 the id-hash is stored with the jcr:uuid making the rep:userId property redundant. It has been removed from the node type definition.

P_PASSWORD

public static final Name P_PASSWORD

P_DISABLED

public static final Name P_DISABLED

P_GROUPS

public static final Name P_GROUPS
Deprecated. As of 2.0 group membership is stored with the group node.
See Also:
P_MEMBERS

P_MEMBERS

public static final Name P_MEMBERS

N_MEMBERS

public static final Name N_MEMBERS

P_IMPERSONATORS

public static final Name P_IMPERSONATORS
Name of the user property containing the principal names of those allowed to impersonate.


NT_REP_AUTHORIZABLE

public static final Name NT_REP_AUTHORIZABLE

NT_REP_AUTHORIZABLE_FOLDER

public static final Name NT_REP_AUTHORIZABLE_FOLDER

NT_REP_USER

public static final Name NT_REP_USER

NT_REP_GROUP

public static final Name NT_REP_GROUP

NT_REP_MEMBERS

public static final Name NT_REP_MEMBERS

MIX_REP_IMPERSONATABLE

public static final Name MIX_REP_IMPERSONATABLE
Constructor Detail

UserImpl

protected UserImpl(NodeImpl node,
                   UserManagerImpl userManager)
Method Detail

isGroup

public boolean isGroup()
Specified by:
isGroup in interface Authorizable
Returns:
if the current Authorizable is a Group
See Also:
Authorizable.isGroup()

getPrincipal

public Principal getPrincipal()
                       throws RepositoryException
Specified by:
getPrincipal in interface Authorizable
Returns:
a representation as Principal.
Throws:
RepositoryException - If an error occurs.
See Also:
Authorizable.getPrincipal()

isAdmin

public boolean isAdmin()
Specified by:
isAdmin in interface User
Returns:
true if the current user represents the administrator.
See Also:
User.isAdmin()

getCredentials

public Credentials getCredentials()
                           throws RepositoryException
Description copied from interface: User
Returns the internal Credentials representation for this user. This method is expected to be used for validation during the login process. However, the return value should neither be usable nor used for Repository.login(javax.jcr.Credentials, java.lang.String).

Specified by:
getCredentials in interface User
Returns:
Credentials for this user.
Throws:
RepositoryException - If an error occurs.
See Also:
User.getCredentials()

getImpersonation

public Impersonation getImpersonation()
                               throws RepositoryException
Specified by:
getImpersonation in interface User
Returns:
Impersonation for this User.
Throws:
RepositoryException - If an error occurs.
See Also:
User.getImpersonation()

changePassword

public void changePassword(String password)
                    throws RepositoryException
Description copied from interface: User
Change the password of this user.

Specified by:
changePassword in interface User
Parameters:
password - The new password.
Throws:
RepositoryException - If an error occurs.
See Also:
User.changePassword(String)

disable

public void disable(String reason)
             throws RepositoryException
Description copied from interface: User
Disable this user thus preventing future login if the reason is a non-null String.
Note however, that this user will still be accessible by UserManager.getAuthorizable(java.lang.String).

Specified by:
disable in interface User
Parameters:
reason - String describing the reason for disable this user or null if the user account should be enabled again.
Throws:
RepositoryException
See Also:
User.disable(String)

isDisabled

public boolean isDisabled()
                   throws RepositoryException
Description copied from interface: User
Returns true if this user is disabled, false otherwise.

Specified by:
isDisabled in interface User
Returns:
true if this user is disabled, false otherwise.
Throws:
RepositoryException
See Also:
User.isDisabled()

getDisabledReason

public String getDisabledReason()
                         throws RepositoryException
Description copied from interface: User
Returns the String specified upon disabling this user or null if User.isDisabled() returns false.

Specified by:
getDisabledReason in interface User
Returns:
The reason specified upon disabling this user or null if this user is not disabled.
Throws:
RepositoryException
See Also:
User.getDisabledReason()

getID

public String getID()
             throws RepositoryException
Returns the unescaped name of the node that defines this Authorizable.

Specified by:
getID in interface Authorizable
Returns:
the unescaped name of the node that defines this Authorizable.
Throws:
RepositoryException - if an error occurs.
See Also:
Authorizable.getID()

declaredMemberOf

public Iterator<Group> declaredMemberOf()
                                 throws RepositoryException
Specified by:
declaredMemberOf in interface Authorizable
Returns:
all Groups, this Authorizable is declared member of.
Throws:
RepositoryException - If an error occurs.
See Also:
Authorizable.declaredMemberOf()

memberOf

public Iterator<Group> memberOf()
                         throws RepositoryException
Specified by:
memberOf in interface Authorizable
Returns:
all Groups, this Authorizable is member of included indirect group membership.
Throws:
RepositoryException - If an error occurs.
See Also:
Authorizable.memberOf()

getPropertyNames

public Iterator<String> getPropertyNames()
                                  throws RepositoryException
Description copied from interface: Authorizable
Returns the names of properties present with this Authorizable not taking possible relative paths into consideration. Same as Authorizable.getPropertyNames(String) where the specified string is ".".

Specified by:
getPropertyNames in interface Authorizable
Returns:
names of properties.
Throws:
RepositoryException - If an error occurs.
See Also:
Authorizable.getPropertyNames()

getPropertyNames

public Iterator<String> getPropertyNames(String relPath)
                                  throws RepositoryException
Description copied from interface: Authorizable
Returns the names of properties present with this Authorizable at the specified relative path.

Specified by:
getPropertyNames in interface Authorizable
Returns:
names of properties.
Throws:
RepositoryException - If an error occurs.
See Also:
Authorizable.getPropertyNames(String)

hasProperty

public boolean hasProperty(String relPath)
                    throws RepositoryException
Description copied from interface: Authorizable
Tests if a the property with specified name exists.

Specified by:
hasProperty in interface Authorizable
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:
getProperty(String)

getProperty

public Value[] getProperty(String relPath)
                    throws RepositoryException
Description copied from interface: Authorizable
Returns the values for the properties with the specified name or null.

Specified by:
getProperty in interface Authorizable
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.
See Also:
hasProperty(String), Authorizable.getProperty(String)

setProperty

public void setProperty(String relPath,
                        Value value)
                 throws RepositoryException
Sets the Value for the given name. If a value existed, it is replaced, if not it is created.

Specified by:
setProperty in interface Authorizable
Parameters:
relPath - The relative path to the property or the property name.
value - The property value.
Throws:
RepositoryException - If the specified name defines a property that needs to be modified by this user API or setting the corresponding JCR property fails.
See Also:
Authorizable.setProperty(String, Value)

setProperty

public void setProperty(String relPath,
                        Value[] values)
                 throws RepositoryException
Sets the Value[] for the given name. If a value existed, it is replaced, if not it is created.

Specified by:
setProperty in interface Authorizable
Parameters:
relPath - The relative path to the property or the property name.
values - The property values.
Throws:
RepositoryException - If the specified name defines a property that needs to be modified by this user API or setting the corresponding JCR property fails.
See Also:
Authorizable.setProperty(String, Value[])

removeProperty

public boolean removeProperty(String relPath)
                       throws RepositoryException
Description copied from interface: Authorizable
Removes the property with the given name.

Specified by:
removeProperty in interface Authorizable
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.
See Also:
Authorizable.removeProperty(String)

remove

public void remove()
            throws RepositoryException
Description copied from interface: Authorizable
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).

Specified by:
remove in interface Authorizable
Throws:
RepositoryException - If an error occurred and the Authorizable could not be removed.
See Also:
Authorizable.remove()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.