Interface UserManager
-
- All Superinterfaces:
Authenticator,EventListener,Serializable
- All Known Implementing Classes:
FakeUserManagerImpl,MultiTenantUserManager,UserManagerImpl,UserManagerWithComputedGroups
public interface UserManager extends Authenticator, EventListener, Serializable
- Author:
- Anahide Tchertchian, Sun Seng David TAN, Benjamin Jalon
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classUserManager.MatchType
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description BooleanareGroupsReadOnly()Returns true is users referential is read only (ie : LDAP) -> can not add users -> can not delete users.BooleanareUsersReadOnly()Returns true is groups referential is read only (ie : LDAP) -> can not add groups -> can not delete groups.booleancheckUsernamePassword(String username, String password)Check the password for the given username.DocumentModelcreateGroup(DocumentModel groupModel)Creates a group from given modelDocumentModelcreateUser(DocumentModel userModel)Creates user from given model.voiddeleteGroup(String groupId)Deletes group with given id.voiddeleteGroup(DocumentModel groupModel)Deletes group represented by given model.voiddeleteUser(String userId)Deletes user with given id.voiddeleteUser(DocumentModel userModel)Deletes user represented by given model.List<String>getAdministratorsGroups()Returns the list of administrators groups.List<String>getAncestorGroups(String groupId)Returns the ancestor groups of the group with the given id.StringgetAnonymousUserId()Gets the anonymous user id.DocumentModelgetBareGroupModel()Returns a bare group model.DocumentModelgetBareUserModel()Returns a bare user model.StringgetDefaultGroup()List<String>getDescendantGroups(String groupId)Returns the descendant groups of the group with the given id.StringgetDigestAuthDirectory()Gets the Digest Auth directory.StringgetDigestAuthRealm()Gets the Digest Auth realm.NuxeoGroupgetGroup(String groupName)Returns the nuxeo group with given name or null if it does not exist.GroupConfiggetGroupConfig()Returns the contributedGroupConfig.StringgetGroupDirectoryName()Gets the group directory name.StringgetGroupIdField()Returns the group directory id field.List<String>getGroupIds()Returns the list of all groups ids.StringgetGroupLabelField()Returns the group label field.StringgetGroupListingMode()StringgetGroupMembersField()Gets the group members field.DocumentModelgetGroupModel(String groupName)Return the group document model with this id or null if group does not exist.StringgetGroupParentGroupsField()Gets the group parent-groups field.StringgetGroupSchemaName()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.StringgetGroupSubGroupsField()Gets the group sub-groups field.default NuxeoPrincipalgetPrincipal(String username)CallsgetPrincipal(String, boolean)to retrieve a principal and its references, given its usernameNuxeoPrincipalgetPrincipal(String username, boolean fetchReferences)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.StringgetUserDirectoryName()Gets the user directory name.StringgetUserEmailField()Gets the user email field.StringgetUserIdField()Returns the user directory id field.List<String>getUserIds()Returns the list of all user ids.StringgetUserListingMode()DocumentModelgetUserModel(String userName)Returns the document model representing user with given id or null if it does not exist.PatterngetUserPasswordPattern()StringgetUserSchemaName()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.StringgetUserSortField()default voidnotifyGroupChanged(String groupName, String eventId)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 thegroupNameas the"id"property of the fired event.voidnotifyGroupChanged(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 thegroupNameas the"id"property of the fired event.voidnotifyUserChanged(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 theuserNameas the"id"property of the fired event.DocumentModelListsearchGroups(String pattern)Search matching groups through their defined search fieldsDocumentModelListsearchGroups(Map<String,Serializable> filter, Set<String> fulltext)Returns groups matching given criteria.DocumentModelListsearchGroups(QueryBuilder queryBuilder)Returns groups matching the given query.List<NuxeoPrincipal>searchPrincipals(String pattern)Deprecated.DocumentModelListsearchUsers(String pattern)Returns users matching given patternDocumentModelListsearchUsers(Map<String,Serializable> filter, Set<String> fulltext)Returns users matching given criteria.DocumentModelListsearchUsers(QueryBuilder queryBuilder)Returns users matching the given query.voidsetConfiguration(UserManagerDescriptor descriptor)Sets the given configuration on the service.voidupdateGroup(DocumentModel groupModel)Updates group represented by given model.voidupdateUser(DocumentModel userModel)Updates user represented by given model.booleanvalidatePassword(String password)-
Methods inherited from interface org.nuxeo.runtime.api.login.Authenticator
authenticate
-
Methods inherited from interface org.nuxeo.runtime.services.event.EventListener
handleEvent
-
-
-
-
Method Detail
-
checkUsernamePassword
boolean checkUsernamePassword(String username, String password)
Description copied from interface:AuthenticatorCheck the password for the given username. Returns true if the username / password pair match, false otherwise.- Specified by:
checkUsernamePasswordin interfaceAuthenticator- Parameters:
username- the usernamepassword- the password to check- Returns:
- true is valid, false otherwise
-
validatePassword
boolean validatePassword(String password)
-
getPrincipal
default NuxeoPrincipal getPrincipal(String username)
CallsgetPrincipal(String, boolean)to retrieve a principal and its references, given its username
-
getPrincipal
NuxeoPrincipal getPrincipal(String username, boolean fetchReferences)
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.
- Parameters:
username- is the name of the entry in the user directoryfetchReferences- controls if the references (groups) of the user will be fetched- Since:
- 11.1
-
getGroup
NuxeoGroup getGroup(String groupName)
Returns the nuxeo group with given name or null if it does not exist.
-
searchPrincipals
@Deprecated List<NuxeoPrincipal> searchPrincipals(String pattern)
Deprecated.
-
searchGroups
DocumentModelList searchGroups(String pattern)
Search matching groups through their defined search fields- Since:
- 5.5
-
createUser
DocumentModel createUser(DocumentModel userModel) throws UserAlreadyExistsException
Creates user from given model.- Throws:
UserAlreadyExistsException- Since:
- 5.2M4
-
updateUser
void updateUser(DocumentModel userModel)
Updates user represented by given model.- Since:
- 5.2M4
-
deleteUser
void deleteUser(DocumentModel userModel)
Deletes user represented by given model.- Since:
- 5.2M4
-
deleteUser
void deleteUser(String userId)
Deletes user with given id.- Since:
- 5.2M4
-
getBareUserModel
DocumentModel getBareUserModel()
Returns a bare user model.Can be used for user creation/search screens.
- Since:
- 5.2M4
-
getUserModel
DocumentModel getUserModel(String userName)
Returns the document model representing user with given id or null if it does not exist.- Since:
- 5.2M4
-
searchUsers
DocumentModelList searchUsers(String pattern)
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).
- Since:
- 5.2M4
-
searchUsers
DocumentModelList searchUsers(Map<String,Serializable> filter, Set<String> fulltext)
Returns users matching given criteria.- Parameters:
filter- filter with field names as keysfulltext- field names used for fulltext match- Since:
- 5.2M4
-
searchUsers
DocumentModelList searchUsers(QueryBuilder queryBuilder)
Returns users matching the given query.- Parameters:
queryBuilder- the query to use, including limit, offset, ordering and countTotal- Since:
- 10.3
-
getUserListingMode
String getUserListingMode()
-
getUserSortField
String getUserSortField()
-
getUserPasswordPattern
Pattern getUserPasswordPattern()
-
searchGroups
DocumentModelList searchGroups(Map<String,Serializable> filter, Set<String> fulltext)
Returns groups matching given criteria.- Parameters:
filter- filter with field names as keysfulltext- field names used for fulltext match- Since:
- 5.2M4
-
searchGroups
DocumentModelList searchGroups(QueryBuilder queryBuilder)
Returns groups matching the given query.- Parameters:
queryBuilder- the query to use, including limit, offset, ordering and countTotal- Since:
- 10.3
-
createGroup
DocumentModel createGroup(DocumentModel groupModel) throws GroupAlreadyExistsException
Creates a group from given model- Returns:
- the created group model
- Throws:
GroupAlreadyExistsException- Since:
- 5.2M4
-
updateGroup
void updateGroup(DocumentModel groupModel)
Updates group represented by given model.- Since:
- 5.2M4
-
deleteGroup
void deleteGroup(DocumentModel groupModel)
Deletes group represented by given model.- Since:
- 5.2M4
-
deleteGroup
void deleteGroup(String groupId)
Deletes group with given id.- Since:
- 5.2M4
-
getBareGroupModel
DocumentModel getBareGroupModel()
Returns a bare group model.Can be used for group creation/search screens.
- Since:
- 5.2M4
-
getGroupModel
DocumentModel getGroupModel(String groupName)
Return the group document model with this id or null if group does not exist.- Parameters:
groupName- the group identifier- Since:
- 5.2M4
-
getDefaultGroup
String getDefaultGroup()
-
getGroupListingMode
String getGroupListingMode()
-
getGroupsInGroup
List<String> getGroupsInGroup(String parentId)
Returns the list of groups that belong to this group.- Parameters:
parentId- the name of the parent group.
-
getTopLevelGroups
List<String> getTopLevelGroups()
Returns the list of groups that are not members of other groups.
-
getUsersInGroup
List<String> getUsersInGroup(String groupId)
Returns the list of users that belong to this group.- Parameters:
groupId- ID of the group
-
getUsersInGroupAndSubGroups
List<String> getUsersInGroupAndSubGroups(String groupId)
Get users from a group and its subgroups.- Parameters:
groupId- ID of the group
-
areGroupsReadOnly
Boolean areGroupsReadOnly()
Returns true is users referential is read only (ie : LDAP) -> can not add users -> can not delete users.
-
areUsersReadOnly
Boolean areUsersReadOnly()
Returns true is groups referential is read only (ie : LDAP) -> can not add groups -> can not delete groups.
-
getUserDirectoryName
String getUserDirectoryName()
Gets the user directory name.- Returns:
- the user directory name.
-
getUserSchemaName
String getUserSchemaName()
Returns the user directory schema name.- Since:
- 5.2M4
-
getUserIdField
String getUserIdField()
Returns the user directory id field.- Since:
- 5.2M4
-
getUserEmailField
String getUserEmailField()
Gets the user email field.- Returns:
- the user email field.
-
getUserSearchFields
Set<String> getUserSearchFields()
Gets the user search fields, the fields to use when a principal search is done.- Returns:
- the search fields.
-
getGroupDirectoryName
String getGroupDirectoryName()
Gets the group directory name.- Returns:
- the group directory name.
-
getGroupSchemaName
String getGroupSchemaName()
Returns the group directory schema name.- Since:
- 5.2M4
-
getGroupIdField
String getGroupIdField()
Returns the group directory id field.- Since:
- 5.2M4
-
getGroupLabelField
String getGroupLabelField()
Returns the group label field.- Since:
- 5.5
-
getGroupMembersField
String getGroupMembersField()
Gets the group members field.- Returns:
- the group members field.
-
getGroupSubGroupsField
String getGroupSubGroupsField()
Gets the group sub-groups field.- Returns:
- the sub-groups field.
-
getGroupParentGroupsField
String getGroupParentGroupsField()
Gets the group parent-groups field.- Returns:
- the parent-groups field.
-
getAnonymousUserId
String getAnonymousUserId()
Gets the anonymous user id.- Returns:
- the anonymous user id, or the default one if none is defined.
-
getDigestAuthDirectory
String getDigestAuthDirectory()
Gets the Digest Auth directory.
-
getDigestAuthRealm
String getDigestAuthRealm()
Gets the Digest Auth realm.
-
setConfiguration
void setConfiguration(UserManagerDescriptor descriptor)
Sets the given configuration on the service.- Parameters:
descriptor- the descriptor as parsed from xml, merged from the previous one if it exists.
-
getAdministratorsGroups
List<String> getAdministratorsGroups()
Returns the list of administrators groups.- Since:
- 5.3 GA
-
getUsersForPermission
String[] getUsersForPermission(String perm, ACP acp)
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.- Parameters:
perm- the permissionacp- The access control policy of the document- Returns:
- the list of user ids
- Since:
- 5.4.2
-
getAncestorGroups
List<String> getAncestorGroups(String groupId)
Returns the ancestor groups of the group with the given id.- Since:
- 9.2
-
getDescendantGroups
List<String> getDescendantGroups(String groupId)
Returns the descendant groups of the group with the given id.- Since:
- 11.4
-
getGroupConfig
GroupConfig getGroupConfig()
Returns the contributedGroupConfig.- Since:
- 9.3
-
notifyUserChanged
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 the
userNameas the"id"property of the fired event.
- Since:
- 9.2
-
notifyGroupChanged
default void notifyGroupChanged(String groupName, String eventId)
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
groupNameas the"id"property of the fired event.
- Since:
- 9.2
-
notifyGroupChanged
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 the
groupNameas the"id"property of the fired event.
The
ancestorGroupNameslist must contain the ancestor groups of the given group. It can be computed by callinggetAncestorGroups(String). It will be passed as the"ancestorGroups"property of the fired core event.- Since:
- 9.2
-
-