public class FakeUserManagerImpl extends Object implements UserManager
UserManager.MatchType
Constructor and Description |
---|
FakeUserManagerImpl() |
Modifier and Type | Method and Description |
---|---|
Boolean |
areGroupsReadOnly()
Returns true is users referential is read only (ie : LDAP) -> can not add
users -> can not delete users.
|
Boolean |
areUsersReadOnly()
Returns true is groups referential is read only (ie : LDAP) -> can not
add groups -> can not delete groups.
|
Principal |
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.
|
DocumentModel |
createGroup(DocumentModel groupModel)
Creates a group from given model
|
void |
createGroup(NuxeoGroup group) |
void |
createPrincipal(NuxeoPrincipal principal) |
DocumentModel |
createUser(DocumentModel userModel)
Creates user from given model.
|
void |
deleteGroup(DocumentModel groupModel)
Deletes group represented by given model.
|
void |
deleteGroup(NuxeoGroup group) |
void |
deleteGroup(String groupId)
Deletes group with given id.
|
void |
deletePrincipal(NuxeoPrincipal principal) |
void |
deleteUser(DocumentModel userModel)
Deletes user represented by given model.
|
void |
deleteUser(String userId)
Deletes user with given id.
|
List<String> |
getAdministratorsGroups()
Returns the list of administrators groups.
|
String |
getAnonymousUserId()
Gets the anonymous user id.
|
List<NuxeoGroup> |
getAvailableGroups() |
List<NuxeoPrincipal> |
getAvailablePrincipals() |
DocumentModel |
getBareGroupModel()
Returns a bare group model.
|
DocumentModel |
getBareUserModel()
Returns a bare user model.
|
String |
getDefaultGroup() |
String |
getDigestAuthDirectory()
Gets the Digest Auth directory.
|
String |
getDigestAuthRealm()
Gets the Digest Auth realm.
|
NuxeoGroup |
getGroup(String groupName)
Returns the nuxeo group with given name or null if it does not exist.
|
String |
getGroupDirectoryName()
Gets the group directory name.
|
String |
getGroupIdField()
Returns the group directory id field.
|
List<String> |
getGroupIds()
Returns the list of all groups ids.
|
String |
getGroupLabelField()
Returns the group label field.
|
String |
getGroupListingMode() |
String |
getGroupMembersField()
Gets the group members field.
|
DocumentModel |
getGroupModel(String groupName)
Return the group document model with this id or null if group does not
exist.
|
String |
getGroupParentGroupsField()
Gets the group parent-groups field.
|
String |
getGroupSchemaName()
Returns the group directory schema name.
|
Set<String> |
getGroupSearchFields()
Gets the group search fields.
|
List<String> |
getGroupsInGroup(String parentId)
Returns the list of groups that belong to this group.
|
String |
getGroupSubGroupsField()
Gets the group sub-groups field.
|
DocumentModel |
getModelForUser(String name) |
NuxeoPrincipal |
getPrincipal(String username)
Retrieves the principal with the given username or null if it does not
exist.
|
List<String> |
getTopLevelGroups()
Returns the list of groups that are not members of other groups.
|
String |
getUserDirectoryName()
Gets the user directory name.
|
String |
getUserEmailField()
Gets the user email field.
|
String |
getUserIdField()
Returns the user directory id field.
|
List<String> |
getUserIds()
Returns the list of all user ids.
|
String |
getUserListingMode() |
DocumentModel |
getUserModel(String userName)
Returns the document model representing user with given id or null if it
does not exist.
|
Pattern |
getUserPasswordPattern() |
String |
getUserSchemaName()
Returns the user directory schema name.
|
Set<String> |
getUserSearchFields()
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.
|
List<String> |
getUsersInGroup(String groupId)
Returns the list of users that belong to this group.
|
List<String> |
getUsersInGroupAndSubGroups(String groupId)
Get users from a group and its subgroups.
|
String |
getUserSortField() |
List<NuxeoPrincipal> |
searchByMap(Map<String,Serializable> filter,
Set<String> pattern) |
DocumentModelList |
searchGroups(Map<String,Serializable> filter,
Set<String> fulltext)
Returns groups matching given criteria.
|
DocumentModelList |
searchGroups(String pattern)
Search matching groups through their defined search fields
|
List<NuxeoPrincipal> |
searchPrincipals(String pattern) |
DocumentModelList |
searchUsers(Map<String,Serializable> filter,
Set<String> fulltext)
Returns users matching given criteria.
|
DocumentModelList |
searchUsers(String pattern)
Returns users matching given pattern
|
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 |
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 |
updateGroup(NuxeoGroup group) |
void |
updatePrincipal(NuxeoPrincipal principal) |
void |
updateUser(DocumentModel userModel)
Updates user represented by given model.
|
boolean |
validatePassword(String password) |
public String getUserListingMode()
getUserListingMode
in interface UserManager
public void setUserListingMode(String userListingMode)
public String getGroupListingMode()
getGroupListingMode
in interface UserManager
public void setGroupListingMode(String groupListingMode)
public String getDefaultGroup()
getDefaultGroup
in interface UserManager
public void setDefaultGroup(String defaultGroup)
public String getUserSortField()
getUserSortField
in interface UserManager
public void setUserSortField(String sortField)
public void setGroupSortField(String sortField)
public void setUserDirectoryName(String userDirectoryName)
public String getUserDirectoryName()
UserManager
getUserDirectoryName
in interface UserManager
public void setUserEmailField(String userEmailField)
public String getUserEmailField()
UserManager
getUserEmailField
in interface UserManager
public void setUserSearchFields(Map<String,UserManager.MatchType> userSearchFields)
public Set<String> getUserSearchFields()
UserManager
getUserSearchFields
in interface UserManager
public Set<String> getGroupSearchFields()
UserManager
getGroupSearchFields
in interface UserManager
public void setGroupDirectoryName(String groupDirectoryName)
public String getGroupDirectoryName()
UserManager
getGroupDirectoryName
in interface UserManager
public void setGroupMembersField(String groupMembersField)
public String getGroupMembersField()
UserManager
getGroupMembersField
in interface UserManager
public void setGroupSubGroupsField(String groupSubGroupsField)
public String getGroupSubGroupsField()
UserManager
getGroupSubGroupsField
in interface UserManager
public void setGroupParentGroupsField(String groupParentGroupsField)
public String getGroupParentGroupsField()
UserManager
getGroupParentGroupsField
in interface UserManager
public Boolean areGroupsReadOnly() throws ClientException
UserManager
areGroupsReadOnly
in interface UserManager
ClientException
public Boolean areUsersReadOnly() throws ClientException
UserManager
areUsersReadOnly
in interface UserManager
ClientException
public boolean checkUsernamePassword(String username, String password) throws ClientException
Authenticator
checkUsernamePassword
in interface UserManager
checkUsernamePassword
in interface Authenticator
username
- the usernamepassword
- the password to checkClientException
public boolean validatePassword(String password)
validatePassword
in interface UserManager
public List<String> getGroupsInGroup(String parentId) throws ClientException
UserManager
getGroupsInGroup
in interface UserManager
parentId
- the name of the parent group.ClientException
public NuxeoPrincipal getPrincipal(String username) throws ClientException
UserManager
Can build principals for anonymous and virtual users as well as for users defined in the users directory.
getPrincipal
in interface UserManager
ClientException
public List<String> getTopLevelGroups() throws ClientException
UserManager
getTopLevelGroups
in interface UserManager
ClientException
public List<String> getUsersInGroup(String groupId) throws ClientException
UserManager
getUsersInGroup
in interface UserManager
groupId
- ID of the groupClientException
public List<String> getUsersInGroupAndSubGroups(String groupId) throws ClientException
UserManager
getUsersInGroupAndSubGroups
in interface UserManager
groupId
- ID of the groupClientException
public DocumentModelList searchGroups(String pattern) throws ClientException
UserManager
searchGroups
in interface UserManager
ClientException
public List<NuxeoPrincipal> searchPrincipals(String pattern) throws ClientException
searchPrincipals
in interface UserManager
ClientException
public Pattern getUserPasswordPattern()
getUserPasswordPattern
in interface UserManager
public void setUserPasswordPattern(Pattern userPasswordPattern)
public void setAnonymousUser(VirtualUser anonymousUser)
public void setVirtualUsers(Map<String,VirtualUserDescriptor> virtualUsers)
public String getAnonymousUserId()
UserManager
getAnonymousUserId
in interface UserManager
public String getDigestAuthDirectory()
UserManager
getDigestAuthDirectory
in interface UserManager
public String getDigestAuthRealm()
UserManager
getDigestAuthRealm
in interface UserManager
public void setConfiguration(UserManagerDescriptor descriptor)
UserManager
setConfiguration
in interface UserManager
descriptor
- the descriptor as parsed from xml, merged from the
previous one if it exists.public DocumentModel getBareUserModel() throws ClientException
UserManager
Can be used for user creation/search screens.
getBareUserModel
in interface UserManager
ClientException
public DocumentModel createGroup(DocumentModel groupModel) throws ClientException
UserManager
createGroup
in interface UserManager
ClientException
GroupAlreadyExistsException
public DocumentModel createUser(DocumentModel userModel) throws ClientException
UserManager
createUser
in interface UserManager
ClientException
UserAlreadyExistsException
public void deleteGroup(DocumentModel groupModel) throws ClientException
UserManager
deleteGroup
in interface UserManager
DirectoryException
- if given entry does not existClientException
public void deleteGroup(String groupId) throws ClientException
UserManager
deleteGroup
in interface UserManager
DirectoryException
- if given entry does not existClientException
public void deleteUser(DocumentModel userModel) throws ClientException
UserManager
deleteUser
in interface UserManager
DirectoryException
- if given entry does not existClientException
public void deleteUser(String userId) throws ClientException
UserManager
deleteUser
in interface UserManager
DirectoryException
- if given entry does not existClientException
public DocumentModel getBareGroupModel() throws ClientException
UserManager
Can be used for group creation/search screens.
getBareGroupModel
in interface UserManager
ClientException
public NuxeoGroup getGroup(String groupName) throws ClientException
UserManager
getGroup
in interface UserManager
ClientException
public List<String> getGroupIds() throws ClientException
UserManager
getGroupIds
in interface UserManager
ClientException
public List<String> getUserIds() throws ClientException
UserManager
getUserIds
in interface UserManager
ClientException
public DocumentModelList searchGroups(Map<String,Serializable> filter, Set<String> fulltext) throws ClientException
UserManager
searchGroups
in interface UserManager
filter
- filter with field names as keysfulltext
- field names used for fulltext matchClientException
public DocumentModelList searchUsers(Map<String,Serializable> filter, Set<String> fulltext) throws ClientException
UserManager
searchUsers
in interface UserManager
filter
- filter with field names as keysfulltext
- field names used for fulltext matchClientException
public DocumentModelList searchUsers(String pattern) throws ClientException
UserManager
Pattern is used to fill a filter and fulltext map according to users search fields configuration. Search is performed on each of these fields (OR).
searchUsers
in interface UserManager
ClientException
public void updateGroup(DocumentModel groupModel) throws ClientException
UserManager
updateGroup
in interface UserManager
DirectoryException
- if given entry does not existClientException
public void updateUser(DocumentModel userModel) throws ClientException
UserManager
updateUser
in interface UserManager
ClientException
public DocumentModel getGroupModel(String groupName) throws ClientException
UserManager
getGroupModel
in interface UserManager
groupName
- the group identifierClientException
public DocumentModel getUserModel(String userName) throws ClientException
UserManager
getUserModel
in interface UserManager
ClientException
public String getGroupIdField() throws ClientException
UserManager
getGroupIdField
in interface UserManager
ClientException
public String getGroupLabelField() throws ClientException
UserManager
getGroupLabelField
in interface UserManager
ClientException
public String getGroupSchemaName() throws ClientException
UserManager
getGroupSchemaName
in interface UserManager
ClientException
public String getUserIdField() throws ClientException
UserManager
getUserIdField
in interface UserManager
ClientException
public String getUserSchemaName() throws ClientException
UserManager
getUserSchemaName
in interface UserManager
ClientException
public void createGroup(NuxeoGroup group) throws ClientException
createGroup
in interface UserManager
ClientException
public void createPrincipal(NuxeoPrincipal principal) throws ClientException
createPrincipal
in interface UserManager
ClientException
public void deleteGroup(NuxeoGroup group) throws ClientException
deleteGroup
in interface UserManager
ClientException
public void deletePrincipal(NuxeoPrincipal principal) throws ClientException
deletePrincipal
in interface UserManager
ClientException
public List<NuxeoGroup> getAvailableGroups() throws ClientException
getAvailableGroups
in interface UserManager
ClientException
public List<NuxeoPrincipal> getAvailablePrincipals() throws ClientException
getAvailablePrincipals
in interface UserManager
ClientException
public DocumentModel getModelForUser(String name) throws ClientException
getModelForUser
in interface UserManager
ClientException
public List<NuxeoPrincipal> searchByMap(Map<String,Serializable> filter, Set<String> pattern) throws ClientException
searchByMap
in interface UserManager
ClientException
public void updateGroup(NuxeoGroup group) throws ClientException
updateGroup
in interface UserManager
ClientException
public void updatePrincipal(NuxeoPrincipal principal) throws ClientException
updatePrincipal
in interface UserManager
ClientException
public List<String> getAdministratorsGroups()
UserManager
getAdministratorsGroups
in interface UserManager
public String[] getUsersForPermission(String perm, ACP acp)
UserManager
getUsersForPermission
in interface UserManager
perm
- the permissionacp
- The access control policy of the documentpublic Principal authenticate(String name, String password) throws ClientException
Authenticator
This method is doing the authentication of the given username / password pair and returns the corresponding principal object if authentication succeeded otherwise returns null.
authenticate
in interface Authenticator
ClientException
Copyright © 2011 Nuxeo SA. All Rights Reserved.