Class FakeUserManagerImpl
- All Implemented Interfaces:
Serializable
,UserManager
,Authenticator
,EventListener
- Author:
- Florent Guillaume
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.nuxeo.ecm.platform.usermanager.UserManager
UserManager.MatchType
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns true is users referential is read only (ie : LDAP) -> can not add users -> can not delete users.Returns true is groups referential is read only (ie : LDAP) -> can not add groups -> can not delete groups.authenticate
(String name, String password) Get a principal object for the given username if the username / password pair is valid, otherwise returns null.boolean
checkUsernamePassword
(String username, String password) Check the password for the given username.createGroup
(DocumentModel groupModel) Creates a group from given modelcreateUser
(DocumentModel userModel) Creates user from given model.void
deleteGroup
(String groupId) Deletes group with given id.void
deleteGroup
(DocumentModel groupModel) Deletes group represented by given model.void
deleteUser
(String userId) Deletes user with given id.void
deleteUser
(DocumentModel userModel) Deletes user represented by given model.Returns the list of administrators groups.getAncestorGroups
(String groupId) Returns the ancestor groups of the group with the given id.Gets the anonymous user id.Returns a bare group model.Returns a bare user model.getDescendantGroups
(String groupId) Returns the descendant groups of the group with the given id.Gets the Digest Auth directory.Gets the Digest Auth realm.Returns the nuxeo group with given name or null if it does not exist.Returns the contributedGroupConfig
.Gets the group directory name.Returns the group directory id field.Returns the list of all groups ids.Returns the group label field.Gets the group members field.getGroupModel
(String groupName) Return the group document model with this id or null if group does not exist.Gets the group parent-groups field.Returns the group directory schema name.Gets the group search fields.getGroupsInGroup
(String parentId) Returns the list of groups that belong to this group.Gets the group sub-groups field.getPrincipal
(String username, boolean fetchReferences) Retrieves the principal with the given username or null if it does not exist.Returns the list of groups that are not members of other groups.Gets the user directory name.Gets the user email field.Returns the user directory id field.Returns the list of all user ids.getUserModel
(String userName) Returns the document model representing user with given id or null if it does not exist.Returns the user directory schema name.Gets the user search fields, the fields to use when a principal search is done.String[]
getUsersForPermission
(String perm, ACP acp) For an ACP, get the list of user that has a permission.getUsersInGroup
(String groupId) Returns the list of users that belong to this group.getUsersInGroupAndSubGroups
(String groupId) Get users from a group and its subgroups.void
handleEvent
(Event event) An event was received.void
notifyGroupChanged
(String groupName, String eventId, List<String> ancestorGroupNames) Notifies that the given group has changed with the given event: At the runtime level so that the JaasCacheFlusher listener can make sure the principal cache is reset. At the core level, passing thegroupName
as the"id"
property of the fired event.void
notifyUserChanged
(String userName, String eventId) Notifies that the given user has changed with the given event: At the runtime level so that the JaasCacheFlusher listener can make sure the principal cache is reset. At the core level, passing theuserName
as the"id"
property of the fired event.searchGroups
(String pattern) Search matching groups through their defined search fieldssearchGroups
(Map<String, Serializable> filter, Set<String> fulltext) Returns groups matching given criteria.searchGroups
(QueryBuilder queryBuilder) Returns groups matching the given query.searchPrincipals
(String pattern) searchUsers
(String pattern) Returns users matching given patternsearchUsers
(Map<String, Serializable> filter, Set<String> fulltext) Returns users matching given criteria.searchUsers
(QueryBuilder queryBuilder) Returns users matching the given query.void
setAnonymousUser
(VirtualUser anonymousUser) void
setConfiguration
(UserManagerDescriptor descriptor) Sets the given configuration on the service.void
setDefaultGroup
(String defaultGroup) void
setGroupDirectoryName
(String groupDirectoryName) void
setGroupListingMode
(String groupListingMode) void
setGroupMembersField
(String groupMembersField) void
setGroupParentGroupsField
(String groupParentGroupsField) void
setGroupSearchFields
(Map<String, UserManager.MatchType> groupSearchFields) void
setGroupSortField
(String sortField) void
setGroupSubGroupsField
(String groupSubGroupsField) void
setUserDirectoryName
(String userDirectoryName) void
setUserEmailField
(String userEmailField) void
setUserListingMode
(String userListingMode) void
setUserPasswordPattern
(Pattern userPasswordPattern) void
setUserSearchFields
(Map<String, UserManager.MatchType> userSearchFields) void
setUserSearchFields
(Set<String> userSearchFields) void
setUserSortField
(String sortField) void
setVirtualUsers
(Map<String, VirtualUserDescriptor> virtualUsers) void
updateGroup
(DocumentModel groupModel) Updates group represented by given model.void
updateUser
(DocumentModel userModel) Updates user represented by given model.boolean
validatePassword
(String password) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.ecm.platform.usermanager.UserManager
getPrincipal, notifyGroupChanged
-
Constructor Details
-
FakeUserManagerImpl
public FakeUserManagerImpl()
-
-
Method Details
-
getUserListingMode
- Specified by:
getUserListingMode
in interfaceUserManager
-
setUserListingMode
-
getGroupListingMode
- Specified by:
getGroupListingMode
in interfaceUserManager
-
setGroupListingMode
-
getDefaultGroup
- Specified by:
getDefaultGroup
in interfaceUserManager
-
setDefaultGroup
-
getUserSortField
- Specified by:
getUserSortField
in interfaceUserManager
-
setUserSortField
-
setGroupSortField
-
setUserDirectoryName
-
getUserDirectoryName
Description copied from interface:UserManager
Gets the user directory name.- Specified by:
getUserDirectoryName
in interfaceUserManager
- Returns:
- the user directory name.
-
setUserEmailField
-
getUserEmailField
Description copied from interface:UserManager
Gets the user email field.- Specified by:
getUserEmailField
in interfaceUserManager
- Returns:
- the user email field.
-
setUserSearchFields
-
setUserSearchFields
-
getUserSearchFields
Description copied from interface:UserManager
Gets the user search fields, the fields to use when a principal search is done.- Specified by:
getUserSearchFields
in interfaceUserManager
- Returns:
- the search fields.
-
setGroupSearchFields
-
getGroupSearchFields
Description copied from interface:UserManager
Gets the group search fields.- Specified by:
getGroupSearchFields
in interfaceUserManager
-
setGroupDirectoryName
-
getGroupDirectoryName
Description copied from interface:UserManager
Gets the group directory name.- Specified by:
getGroupDirectoryName
in interfaceUserManager
- Returns:
- the group directory name.
-
setGroupMembersField
-
getGroupMembersField
Description copied from interface:UserManager
Gets the group members field.- Specified by:
getGroupMembersField
in interfaceUserManager
- Returns:
- the group members field.
-
setGroupSubGroupsField
-
getGroupSubGroupsField
Description copied from interface:UserManager
Gets the group sub-groups field.- Specified by:
getGroupSubGroupsField
in interfaceUserManager
- Returns:
- the sub-groups field.
-
setGroupParentGroupsField
-
getGroupParentGroupsField
Description copied from interface:UserManager
Gets the group parent-groups field.- Specified by:
getGroupParentGroupsField
in interfaceUserManager
- Returns:
- the parent-groups field.
-
areGroupsReadOnly
Description copied from interface:UserManager
Returns true is users referential is read only (ie : LDAP) -> can not add users -> can not delete users.- Specified by:
areGroupsReadOnly
in interfaceUserManager
-
areUsersReadOnly
Description copied from interface:UserManager
Returns true is groups referential is read only (ie : LDAP) -> can not add groups -> can not delete groups.- Specified by:
areUsersReadOnly
in interfaceUserManager
-
checkUsernamePassword
Description copied from interface:Authenticator
Check the password for the given username. Returns true if the username / password pair match, false otherwise.- Specified by:
checkUsernamePassword
in interfaceAuthenticator
- Specified by:
checkUsernamePassword
in interfaceUserManager
- Parameters:
username
- the usernamepassword
- the password to check- Returns:
- true is valid, false otherwise
-
validatePassword
- Specified by:
validatePassword
in interfaceUserManager
-
getGroupsInGroup
Description copied from interface:UserManager
Returns the list of groups that belong to this group.- Specified by:
getGroupsInGroup
in interfaceUserManager
- Parameters:
parentId
- the name of the parent group.
-
getPrincipal
Description copied from interface:UserManager
Retrieves the principal with the given username or null if it does not exist.Can build principals for anonymous and virtual users as well as for users defined in the users directory.
- Specified by:
getPrincipal
in interfaceUserManager
- Parameters:
username
- is the name of the entry in the user directoryfetchReferences
- controls if the references (groups) of the user will be fetched
-
getTopLevelGroups
Description copied from interface:UserManager
Returns the list of groups that are not members of other groups.- Specified by:
getTopLevelGroups
in interfaceUserManager
-
getUsersInGroup
Description copied from interface:UserManager
Returns the list of users that belong to this group.- Specified by:
getUsersInGroup
in interfaceUserManager
- Parameters:
groupId
- ID of the group
-
getUsersInGroupAndSubGroups
Description copied from interface:UserManager
Get users from a group and its subgroups.- Specified by:
getUsersInGroupAndSubGroups
in interfaceUserManager
- Parameters:
groupId
- ID of the group
-
searchGroups
Description copied from interface:UserManager
Search matching groups through their defined search fields- Specified by:
searchGroups
in interfaceUserManager
-
searchPrincipals
- Specified by:
searchPrincipals
in interfaceUserManager
-
getUserPasswordPattern
- Specified by:
getUserPasswordPattern
in interfaceUserManager
-
setUserPasswordPattern
-
setAnonymousUser
-
setVirtualUsers
-
getAnonymousUserId
Description copied from interface:UserManager
Gets the anonymous user id.- Specified by:
getAnonymousUserId
in interfaceUserManager
- Returns:
- the anonymous user id, or the default one if none is defined.
-
getDigestAuthDirectory
Description copied from interface:UserManager
Gets the Digest Auth directory.- Specified by:
getDigestAuthDirectory
in interfaceUserManager
-
getDigestAuthRealm
Description copied from interface:UserManager
Gets the Digest Auth realm.- Specified by:
getDigestAuthRealm
in interfaceUserManager
-
setConfiguration
Description copied from interface:UserManager
Sets the given configuration on the service.- Specified by:
setConfiguration
in interfaceUserManager
- Parameters:
descriptor
- the descriptor as parsed from xml, merged from the previous one if it exists.
-
getBareUserModel
Description copied from interface:UserManager
Returns a bare user model.Can be used for user creation/search screens.
- Specified by:
getBareUserModel
in interfaceUserManager
-
createGroup
Description copied from interface:UserManager
Creates a group from given model- Specified by:
createGroup
in interfaceUserManager
- Returns:
- the created group model
-
createUser
Description copied from interface:UserManager
Creates user from given model.- Specified by:
createUser
in interfaceUserManager
-
deleteGroup
Description copied from interface:UserManager
Deletes group represented by given model.- Specified by:
deleteGroup
in interfaceUserManager
-
deleteGroup
Description copied from interface:UserManager
Deletes group with given id.- Specified by:
deleteGroup
in interfaceUserManager
-
deleteUser
Description copied from interface:UserManager
Deletes user represented by given model.- Specified by:
deleteUser
in interfaceUserManager
-
deleteUser
Description copied from interface:UserManager
Deletes user with given id.- Specified by:
deleteUser
in interfaceUserManager
-
getBareGroupModel
Description copied from interface:UserManager
Returns a bare group model.Can be used for group creation/search screens.
- Specified by:
getBareGroupModel
in interfaceUserManager
-
getGroup
Description copied from interface:UserManager
Returns the nuxeo group with given name or null if it does not exist.- Specified by:
getGroup
in interfaceUserManager
-
getGroupIds
Description copied from interface:UserManager
Returns the list of all groups ids.- Specified by:
getGroupIds
in interfaceUserManager
-
getUserIds
Description copied from interface:UserManager
Returns the list of all user ids.- Specified by:
getUserIds
in interfaceUserManager
-
searchGroups
Description copied from interface:UserManager
Returns groups matching given criteria.- Specified by:
searchGroups
in interfaceUserManager
- Parameters:
filter
- filter with field names as keysfulltext
- field names used for fulltext match
-
searchGroups
Description copied from interface:UserManager
Returns groups matching the given query.- Specified by:
searchGroups
in interfaceUserManager
- Parameters:
queryBuilder
- the query to use, including limit, offset, ordering and countTotal
-
searchUsers
Description copied from interface:UserManager
Returns users matching given criteria.- Specified by:
searchUsers
in interfaceUserManager
- Parameters:
filter
- filter with field names as keysfulltext
- field names used for fulltext match
-
searchUsers
Description copied from interface:UserManager
Returns users matching given patternPattern is used to fill a filter and fulltext map according to users search fields configuration. Search is performed on each of these fields (OR).
- Specified by:
searchUsers
in interfaceUserManager
-
searchUsers
Description copied from interface:UserManager
Returns users matching the given query.- Specified by:
searchUsers
in interfaceUserManager
- Parameters:
queryBuilder
- the query to use, including limit, offset, ordering and countTotal
-
updateGroup
Description copied from interface:UserManager
Updates group represented by given model.- Specified by:
updateGroup
in interfaceUserManager
-
updateUser
Description copied from interface:UserManager
Updates user represented by given model.- Specified by:
updateUser
in interfaceUserManager
-
getGroupModel
Description copied from interface:UserManager
Return the group document model with this id or null if group does not exist.- Specified by:
getGroupModel
in interfaceUserManager
- Parameters:
groupName
- the group identifier
-
getUserModel
Description copied from interface:UserManager
Returns the document model representing user with given id or null if it does not exist.- Specified by:
getUserModel
in interfaceUserManager
-
getGroupIdField
Description copied from interface:UserManager
Returns the group directory id field.- Specified by:
getGroupIdField
in interfaceUserManager
-
getGroupLabelField
Description copied from interface:UserManager
Returns the group label field.- Specified by:
getGroupLabelField
in interfaceUserManager
-
getGroupSchemaName
Description copied from interface:UserManager
Returns the group directory schema name.- Specified by:
getGroupSchemaName
in interfaceUserManager
-
getUserIdField
Description copied from interface:UserManager
Returns the user directory id field.- Specified by:
getUserIdField
in interfaceUserManager
-
getUserSchemaName
Description copied from interface:UserManager
Returns the user directory schema name.- Specified by:
getUserSchemaName
in interfaceUserManager
-
getAdministratorsGroups
Description copied from interface:UserManager
Returns the list of administrators groups.- Specified by:
getAdministratorsGroups
in interfaceUserManager
-
getUsersForPermission
Description copied from interface:UserManager
For an ACP, get the list of user that has a permission. This method should be use with care as it can cause performance issues while getting the list of users.- Specified by:
getUsersForPermission
in interfaceUserManager
- Parameters:
perm
- the permissionacp
- The access control policy of the document- Returns:
- the list of user ids
-
authenticate
Description copied from interface:Authenticator
Get a principal object for the given username if the username / password pair is valid, otherwise returns null.This method is doing the authentication of the given username / password pair and returns the corresponding principal object if authentication succeeded otherwise returns null.
- Specified by:
authenticate
in interfaceAuthenticator
- Returns:
- the authenticated principal if authentication succeded otherwise null
-
handleEvent
Description copied from interface:EventListener
An event was received.- Specified by:
handleEvent
in interfaceEventListener
-
getAncestorGroups
Description copied from interface:UserManager
Returns the ancestor groups of the group with the given id.- Specified by:
getAncestorGroups
in interfaceUserManager
-
getDescendantGroups
Description copied from interface:UserManager
Returns the descendant groups of the group with the given id.- Specified by:
getDescendantGroups
in interfaceUserManager
-
getGroupConfig
Description copied from interface:UserManager
Returns the contributedGroupConfig
.- Specified by:
getGroupConfig
in interfaceUserManager
-
notifyUserChanged
Description copied from interface:UserManager
Notifies that the given user has changed with the given event:- At the runtime level so that the JaasCacheFlusher listener can make sure the principal cache is reset.
- At the core level, passing the
userName
as the"id"
property of the fired event.
- Specified by:
notifyUserChanged
in interfaceUserManager
-
notifyGroupChanged
Description copied from interface:UserManager
Notifies that the given group has changed with the given event:- At the runtime level so that the JaasCacheFlusher listener can make sure the principal cache is reset.
- At the core level, passing the
groupName
as the"id"
property of the fired event.
The
ancestorGroupNames
list must contain the ancestor groups of the given group. It can be computed by callingUserManager.getAncestorGroups(String)
. It will be passed as the"ancestorGroups"
property of the fired core event.- Specified by:
notifyGroupChanged
in interfaceUserManager
-