info.magnolia.cms.security
Interface UserManager

All Known Implementing Classes:
DelegatingUserManager, ExternalUserManager, HierarchicalUserManager, MgnlUserManager, RescueSecuritySupport.RescueUserManager, SystemUserManager

public interface UserManager

Manages users.


Field Summary
static String ANONYMOUS_USER
          Anonymous user name.
static String SYSTEM_PSWD
          Magnolia system default password.
static String SYSTEM_USER
          Magnolia system user name.
 
Method Summary
 User addGroup(User user, String groupName)
          Adds user to a group.
 User addRole(User user, String roleName)
          Grants user role.
 User changePassword(User user, String newPassword)
          Sets a new password.
 User createUser(String name, String pw)
          Creates a user without security restrictions.
 User createUser(String path, String name, String pw)
          Creates a user on given path.
 Map<String,ACL> getACLs(User user)
           
 Collection<User> getAllUsers()
          Get all users.
 User getAnonymousUser()
          Get Anonymous user, this user must always exist in magnolia repository.
 int getLockTimePeriod()
          Gets a time period for account lock.
 int getMaxFailedLoginAttempts()
          Gets a number of failed attempts before locking account.
 User getSystemUser()
          Get system user, this user must always exist in magnolia repository.
 User getUser(String name)
          Find a specific user.
 User getUser(Subject subject)
          Deprecated. jaas login module should just request the user, not pass the subject around to the user manager
 User getUserById(String id)
          Find a specific user.
 boolean hasAny(String principal, String resourceName, String resourceType)
           
 User removeGroup(User user, String groupName)
          Removes user from a group.
 User removeRole(User user, String roleName)
          Removes role from a user.
 void setLockTimePeriod(int lockTimePeriod)
          Sets a time period for account lock.
 void setMaxFailedLoginAttempts(int maxFailedLoginAttempts)
          Sets a number of failed attempts before locking account.
 User setProperty(User user, String propertyName, String propertyValue)
          Sets given property for the user and returns updated user object with new value of the property.
 User setProperty(User user, String propertyName, javax.jcr.Value propertyValue)
          Deprecated. since 4.5.7 - use setProperty(User, String, String)
 void updateLastAccessTimestamp(User user)
          Updates last access timestamp for the user.
 

Field Detail

SYSTEM_USER

static final String SYSTEM_USER
Magnolia system user name.

See Also:
Constant Field Values

SYSTEM_PSWD

static final String SYSTEM_PSWD
Magnolia system default password.

See Also:
Constant Field Values

ANONYMOUS_USER

static final String ANONYMOUS_USER
Anonymous user name.

See Also:
Constant Field Values
Method Detail

getUser

User getUser(String name)
             throws UnsupportedOperationException
Find a specific user. Not all implementations will support this method.

Parameters:
name - the name of the user
Returns:
the user object
Throws:
UnsupportedOperationException

getUserById

User getUserById(String id)
                 throws UnsupportedOperationException
Find a specific user. Not all implementations will support this method.

Parameters:
id - user identifier
Returns:
the user object
Throws:
UnsupportedOperationException

getUser

@Deprecated
User getUser(Subject subject)
             throws UnsupportedOperationException
Deprecated. jaas login module should just request the user, not pass the subject around to the user manager

Initialize new user using JAAS authenticated/authorized subject.

Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

getSystemUser

User getSystemUser()
                   throws UnsupportedOperationException
Get system user, this user must always exist in magnolia repository.

Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

getAnonymousUser

User getAnonymousUser()
                      throws UnsupportedOperationException
Get Anonymous user, this user must always exist in magnolia repository.

Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

getAllUsers

Collection<User> getAllUsers()
                             throws UnsupportedOperationException
Get all users.

Returns:
collection of User objects
Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

createUser

User createUser(String name,
                String pw)
                throws UnsupportedOperationException
Creates a user without security restrictions.

Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

createUser

User createUser(String path,
                String name,
                String pw)
                throws UnsupportedOperationException
Creates a user on given path.

Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

changePassword

User changePassword(User user,
                    String newPassword)
                    throws UnsupportedOperationException
Sets a new password.

Returns:
user object with updated password.
Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

setProperty

@Deprecated
User setProperty(User user,
                            String propertyName,
                            javax.jcr.Value propertyValue)
Deprecated. since 4.5.7 - use setProperty(User, String, String)

Sets given property for the user.

Parameters:
user - User to be updated. If property doesn't exist yet, it will be created. If the value is null, property will be removed if existing.
propertyName - Name of the property.
propertyValue - Value of the property. Use org.apache.jackrabbit.value.ValueFactoryImpl to convert type to Value.
Returns:
updated user object with new value of the property.

setProperty

User setProperty(User user,
                 String propertyName,
                 String propertyValue)
Sets given property for the user and returns updated user object with new value of the property.


setLockTimePeriod

void setLockTimePeriod(int lockTimePeriod)
                       throws UnsupportedOperationException
Sets a time period for account lock.

Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

getLockTimePeriod

int getLockTimePeriod()
                      throws UnsupportedOperationException
Gets a time period for account lock.

Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

setMaxFailedLoginAttempts

void setMaxFailedLoginAttempts(int maxFailedLoginAttempts)
                               throws UnsupportedOperationException
Sets a number of failed attempts before locking account.

Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

getMaxFailedLoginAttempts

int getMaxFailedLoginAttempts()
                              throws UnsupportedOperationException
Gets a number of failed attempts before locking account.

Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

addRole

User addRole(User user,
             String roleName)
Grants user role.

Returns:
user object with the role already granted.

addGroup

User addGroup(User user,
              String groupName)
Adds user to a group.

Returns:
user object with the group already assigned.

updateLastAccessTimestamp

void updateLastAccessTimestamp(User user)
                               throws UnsupportedOperationException
Updates last access timestamp for the user.

Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

hasAny

boolean hasAny(String principal,
               String resourceName,
               String resourceType)
Parameters:
principal - name of the principal
resourceName - either group or role name
resourceType - either group or role see
Returns:
whether principal belongs to the named resource.

getACLs

Map<String,ACL> getACLs(User user)
Returns:
all ACLs assigned to the given user.

removeGroup

User removeGroup(User user,
                 String groupName)
Removes user from a group.

Returns:
user object with the group assignment removed.

removeRole

User removeRole(User user,
                String roleName)
Removes role from a user.

Returns:
user object without removed role.


Copyright © 2003-2014 Magnolia International Ltd.. All Rights Reserved.