public class MgnlUserManager extends RepositoryBackedSecurityManager implements UserManager
Modifier and Type | Field and Description |
---|---|
static String |
NODE_ACLUSERS |
static String |
PROPERTY_EMAIL |
static String |
PROPERTY_ENABLED |
static String |
PROPERTY_LANGUAGE |
static String |
PROPERTY_LASTACCESS |
static String |
PROPERTY_PASSWORD |
static String |
PROPERTY_TIMEZONE |
static String |
PROPERTY_TITLE |
nodeNameHelper
ANONYMOUS_USER, SYSTEM_PSWD, SYSTEM_USER
Constructor and Description |
---|
MgnlUserManager()
Deprecated.
since 5.5.3, use
MgnlUserManager(NodeNameHelper) instead. |
MgnlUserManager(NodeNameHelper nodeNameHelper)
There should be no need to instantiate this class except maybe for testing.
|
Modifier and Type | Method and Description |
---|---|
User |
addGroup(User user,
String groupName)
Adds user to a group.
|
User |
addRole(User user,
String roleName)
Grants user role.
|
protected Set<String> |
aggregateDirectAndTransitiveGroups(Collection<String> groups,
String name,
GroupManager groupManager) |
protected Set<String> |
aggregateDirectAndTransitiveRoles(Collection<String> roles,
Collection<String> allGroups,
String name,
GroupManager groupManager) |
User |
changePassword(User user,
String newPassword)
Sets a new password.
|
protected Set<String> |
collectUniquePropertyNames(javax.jcr.Node rootNode,
String subnodeName,
String repositoryName,
boolean isDeep)
Collects all property names of given type, sorting them (case insensitive) and removing duplicates in the process.
|
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.
|
protected javax.jcr.Node |
createUserNode(String path,
String userName,
javax.jcr.Session session) |
protected String |
encodePassword(String clearPassword) |
void |
findAllUsersInFolder(javax.jcr.Node node,
Collection<User> addTo)
Finds all users located in the provided node or in sub-folders within it and adds them to the given collection.
|
protected javax.jcr.Node |
findPrincipalNode(String name,
javax.jcr.Session session)
Helper method to find a user in a certain realm.
|
Map<String,ACL> |
getACLs(User user)
Sets access control list from a list of roles under the provided content object.
|
Collection<User> |
getAllUsers()
Get all users managed by this user manager.
|
User |
getAnonymousUser()
SystemUserManager does this.
|
protected User |
getFromRepository(String name) |
int |
getLockTimePeriod()
Gets a time period for account lock.
|
int |
getMaxFailedLoginAttempts()
Gets a number of failed attempts before locking account.
|
String |
getRealmName() |
protected String |
getRepositoryName() |
User |
getSystemUser()
SystemUserManager does this.
|
User |
getUser(String name)
Get the user object.
|
User |
getUser(Subject subject)
Initialize new user using JAAS authenticated/authorized subject.
|
User |
getUserById(String id)
Get the user object.
|
Collection<String> |
getUsersWithGroup(String groupName)
Returns all users which are the provided group.
|
Collection<String> |
getUsersWithGroup(String groupName,
boolean transitive)
Returns all users which are in the provided group.
|
Collection<String> |
getUsersWithRole(String roleName) |
boolean |
isAllowCrossRealmDuplicateNames() |
protected User |
newUserInstance(javax.jcr.Node privilegedUserNode) |
User |
removeGroup(User user,
String groupName)
Removes user from a group.
|
User |
removeRole(User user,
String roleName)
Removes role from a user.
|
void |
setAllowCrossRealmDuplicateNames(boolean allowCrossRealmDuplicateNames) |
void |
setLockTimePeriod(int lockTimePeriod)
Sets a time period for account lock.
|
void |
setMaxFailedLoginAttempts(int maxFailedLoginAttempts)
Sets a number of failed attempts before locking account.
|
protected void |
setPasswordProperty(javax.jcr.Node userNode,
String clearPassword) |
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)
Sets given property for the user.
|
void |
setRealmName(String name) |
void |
updateLastAccessTimestamp(User user)
Updates last access timestamp for the user.
|
protected void |
validateUsername(String name) |
add, findPrincipalNode, findPrincipalNode, findPrincipalNodes, findUsersOrGroupsHavingAssignedGroupOrRoleWithUid, getACLs, getACLs, getResourceName, hasAny, remove
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
hasAny
public static final String PROPERTY_EMAIL
public static final String PROPERTY_LANGUAGE
public static final String PROPERTY_LASTACCESS
public static final String PROPERTY_PASSWORD
public static final String PROPERTY_TITLE
public static final String PROPERTY_ENABLED
public static final String PROPERTY_TIMEZONE
public static final String NODE_ACLUSERS
@Inject public MgnlUserManager(NodeNameHelper nodeNameHelper)
@Deprecated public MgnlUserManager()
MgnlUserManager(NodeNameHelper)
instead.public void setMaxFailedLoginAttempts(int maxFailedLoginAttempts)
UserManager
setMaxFailedLoginAttempts
in interface UserManager
public int getMaxFailedLoginAttempts()
UserManager
getMaxFailedLoginAttempts
in interface UserManager
public int getLockTimePeriod()
UserManager
getLockTimePeriod
in interface UserManager
public void setLockTimePeriod(int lockTimePeriod)
UserManager
setLockTimePeriod
in interface UserManager
public User setProperty(User user, String propertyName, javax.jcr.Value propertyValue)
UserManager
setProperty
in interface UserManager
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.public User setProperty(User user, String propertyName, String propertyValue)
UserManager
setProperty
in interface UserManager
public void setRealmName(String name)
public String getRealmName()
public void setAllowCrossRealmDuplicateNames(boolean allowCrossRealmDuplicateNames)
public boolean isAllowCrossRealmDuplicateNames()
public User getUser(String name)
getUser
in interface UserManager
name
- name of the user to retrievepublic User getUserById(String id)
getUserById
in interface UserManager
id
- user identifierpublic User getUser(Subject subject) throws UnsupportedOperationException
UserManager
getUser
in interface UserManager
UnsupportedOperationException
- if the current implementation doesn't support this operationprotected javax.jcr.Node findPrincipalNode(String name, javax.jcr.Session session) throws javax.jcr.RepositoryException
findPrincipalNode
in class RepositoryBackedSecurityManager
javax.jcr.RepositoryException
protected User getFromRepository(String name) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public User getSystemUser() throws UnsupportedOperationException
getSystemUser
in interface UserManager
UnsupportedOperationException
- if the current implementation doesn't support this operationpublic User getAnonymousUser() throws UnsupportedOperationException
getAnonymousUser
in interface UserManager
UnsupportedOperationException
- if the current implementation doesn't support this operationpublic Collection<User> getAllUsers()
getAllUsers
in interface UserManager
public void findAllUsersInFolder(javax.jcr.Node node, Collection<User> addTo) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public User createUser(String name, String pw)
UserManager
createUser
in interface UserManager
public User createUser(String path, String name, String pw) throws UnsupportedOperationException
UserManager
createUser
in interface UserManager
UnsupportedOperationException
- if the current implementation doesn't support this operationpublic User changePassword(User user, String newPassword)
UserManager
changePassword
in interface UserManager
protected void setPasswordProperty(javax.jcr.Node userNode, String clearPassword) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected void validateUsername(String name)
protected javax.jcr.Node createUserNode(String path, String userName, javax.jcr.Session session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public void updateLastAccessTimestamp(User user) throws UnsupportedOperationException
UserManager
updateLastAccessTimestamp
in interface UserManager
UnsupportedOperationException
- if the current implementation doesn't support this operationprotected User newUserInstance(javax.jcr.Node privilegedUserNode) throws javax.jcr.ValueFormatException, javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
javax.jcr.ValueFormatException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
protected String getRepositoryName()
getRepositoryName
in class RepositoryBackedSecurityManager
public Map<String,ACL> getACLs(User user)
getACLs
in interface UserManager
public User addRole(User user, String roleName)
UserManager
addRole
in interface UserManager
protected Set<String> collectUniquePropertyNames(javax.jcr.Node rootNode, String subnodeName, String repositoryName, boolean isDeep)
public User addGroup(User user, String groupName)
UserManager
addGroup
in interface UserManager
public User removeGroup(User user, String groupName)
UserManager
removeGroup
in interface UserManager
public User removeRole(User user, String roleName)
UserManager
removeRole
in interface UserManager
public Collection<String> getUsersWithGroup(String groupName)
UserManager
getUsersWithGroup
in interface UserManager
groupName
- name of the grouppublic Collection<String> getUsersWithRole(String roleName)
getUsersWithRole
in interface UserManager
public Collection<String> getUsersWithGroup(String groupName, boolean transitive)
UserManager
getUsersWithGroup
in interface UserManager
groupName
- name of the grouptransitive
- whether the method should return also users which are in transitive groups of the given group.protected Set<String> aggregateDirectAndTransitiveRoles(Collection<String> roles, Collection<String> allGroups, String name, GroupManager groupManager)
newUserInstance(Node)
protected Set<String> aggregateDirectAndTransitiveGroups(Collection<String> groups, String name, GroupManager groupManager)
newUserInstance(Node)
Copyright © 2003–2018 Magnolia International Ltd.. All rights reserved.