Class UserManagerImpl
- java.lang.Object
-
- org.nuxeo.ecm.platform.usermanager.UserManagerImpl
-
- All Implemented Interfaces:
Serializable,AdministratorGroupsProvider,MultiTenantUserManager,UserManager,Authenticator,EventListener
- Direct Known Subclasses:
UserManagerWithComputedGroups
public class UserManagerImpl extends Object implements UserManager, MultiTenantUserManager, AdministratorGroupsProvider
Standard implementation of the Nuxeo UserManager.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.nuxeo.ecm.platform.usermanager.UserManager
UserManager.MatchType
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description UserManagerImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendSubgroups(String groupId, Set<String> groups, DocumentModel context)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.Principalauthenticate(String name, String password)Get a principal object for the given username if the username / password pair is valid, otherwise returns null.protected voidcheckGrouId(DocumentModel groupModel)protected voidcheckGroupsExistence(DocumentModel userModel, String schema, DocumentModel context)protected voidcheckPasswordValidity(DocumentModel userModel)protected voidcheckUserId(DocumentModel userModel)booleancheckUsernamePassword(String username, String password)Check the password for the given username.protected Map<String,Serializable>cloneMap(Map<String,Serializable> map)protected HashSet<String>cloneSet(Set<String> set)DocumentModelcreateGroup(DocumentModel groupModel)Creates a group from given modelDocumentModelcreateGroup(DocumentModel groupModel, DocumentModel context)Creates a group from given model with the given context.DocumentModelcreateUser(DocumentModel userModel)Creates user from given model.DocumentModelcreateUser(DocumentModel userModel, DocumentModel context)Creates user from given model into the given context document.voiddeleteGroup(String groupId)Deletes group with given id.voiddeleteGroup(String groupId, DocumentModel context)Deletes group with given id with the given context.voiddeleteGroup(DocumentModel groupModel)Deletes group represented by given model.voiddeleteGroup(DocumentModel groupModel, DocumentModel context)Deletes group represented by given model with the given context.voiddeleteUser(String userId)Deletes user with given id.voiddeleteUser(String userId, DocumentModel context)Deletes user with given id into the given context document.voiddeleteUser(DocumentModel userModel)Deletes user represented by given model.voiddeleteUser(DocumentModel userModel, DocumentModel context)Deletes user represented by given model into the given context document.static StringencodeDigestAuthPassword(String username, String realm, String password)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.protected DocumentModelgetDigestAuthModel()StringgetDigestAuthRealm()Gets the Digest Auth realm.protected Map<String,String>getDirectorySortMap(String descriptorSortField, String fallBackField)NuxeoGroupgetGroup(String groupName)Returns the nuxeo group with given name or null if it does not exist.protected NuxeoGroupgetGroup(String groupName, DocumentModel context)GroupConfiggetGroupConfig()Returns the contributedGroupConfig.StringgetGroupDirectoryName()Gets the group directory name.protected StringgetGroupId(DocumentModel groupModel)StringgetGroupIdField()Returns the group directory id field.List<String>getGroupIds()Returns the list of all groups ids.List<String>getGroupIds(DocumentModel context)Returns the list of all groups ids with the given context.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.DocumentModelgetGroupModel(String groupIdValue, DocumentModel context)Return the group document model with this id concatenated with the directory local config (if not null) or null if group does not exist.protected OrderByExprgetGroupOrderBy()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.List<String>getGroupsInGroup(String parentId, DocumentModel context)Returns the list of groups that belong to this group with the given context.protected Map<String,String>getGroupSortMap()StringgetGroupSubGroupsField()Gets the group sub-groups field.protected List<String>getLeafPermissions(String perm)NuxeoPrincipalgetPrincipal(String username, boolean fetchReferences)Retrieves the principal with the given username or null if it does not exist.NuxeoPrincipalgetPrincipal(String username, DocumentModel context)Retrieves the principal with the given username or null if it does not exist into the given context document.protected NuxeoPrincipalgetPrincipal(String username, DocumentModel context, boolean fetchReferences)protected NuxeoPrincipalgetPrincipalUsingCache(String username)protected QueryBuildergetQueryForPattern(String pattern, String dirName, Map<String,UserManager.MatchType> searchFields, OrderByExpr orderBy)List<String>getTopLevelGroups()Returns the list of groups that are not members of other groups.List<String>getTopLevelGroups(DocumentModel context)Returns the list of groups that are not members of other groups with the given context.StringgetUserDirectoryName()Gets the user directory name.StringgetUserEmailField()Gets the user email field.protected StringgetUserId(DocumentModel userModel)StringgetUserIdField()Returns the user directory id field.List<String>getUserIds()Returns the list of all user ids.List<String>getUserIds(DocumentModel context)Returns the list of all user ids into the given context document.StringgetUserListingMode()DocumentModelgetUserModel(String userName)Returns the document model representing user with given id or null if it does not exist.DocumentModelgetUserModel(String userName, DocumentModel context)Returns the document model representing user with given id or null if it does not exist into the given context document.protected DocumentModelgetUserModel(String userName, DocumentModel context, boolean fetchReferences)protected OrderByExprgetUserOrderBy()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.String[]getUsersForPermission(String perm, ACP acp, DocumentModel context)For an ACP, get the list of user that has a permission into the given context.List<String>getUsersInGroup(String groupId)Returns the list of users that belong to this group.List<String>getUsersInGroup(String groupId, DocumentModel context)Returns the list of users that belong to this group into the given contextList<String>getUsersInGroupAndSubGroups(String groupId)Get users from a group and its subgroups.List<String>getUsersInGroupAndSubGroups(String groupId, DocumentModel context)Get users from a group and its subgroups into the given contextStringgetUserSortField()protected Map<String,String>getUserSortMap()voidhandleEvent(Event event)An event was received.protected voidinvalidateAllPrincipals()protected voidinvalidatePrincipal(String userName)protected booleanisAnonymousMatching(Map<String,Serializable> filter, Set<String> fulltext)protected booleanisAnonymousMatching(QueryBuilder queryBuilder, Directory dir)protected NuxeoPrincipalmakeAnonymousPrincipal()protected NuxeoGroupmakeGroup(DocumentModel groupEntry)protected NuxeoPrincipalmakePrincipal(DocumentModel userEntry)protected NuxeoPrincipalmakePrincipal(DocumentModel userEntry, boolean anonymous, boolean isTransient, List<String> groups)protected NuxeoPrincipalmakePrincipal(DocumentModel userEntry, boolean anonymous, List<String> groups)protected NuxeoPrincipalmakeTransientPrincipal(String username)protected NuxeoPrincipalmakeVirtualPrincipal(VirtualUser user)protected DocumentModelmakeVirtualUserEntry(String id, VirtualUser user)protected voidnotifyCore(String userOrGroupId, String eventId)protected voidnotifyCore(String userOrGroupId, String eventId, List<String> ancestorGroupIds)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.protected voidnotifyRuntime(String userOrGroupName, String eventId)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.protected voidpopulateAncestorGroups(String groupId, List<String> ancestorGroups)protected voidpopulateDescendantGroups(String groupId, List<String> descendantGroups)protected DocumentModelListqueryWithVirtualEntries(Session session, QueryBuilder queryBuilder, List<DocumentModel> virtualEntries)Executes a query then adds virtual entries (already supposed to match the query).protected voidremoveVirtualFilters(Map<String,Serializable> filter)DocumentModelListsearchGroups(String pattern)Search matching groups through their defined search fieldsDocumentModelListsearchGroups(String pattern, DocumentModel context)Search matching groups through their defined search fields into the given context document.DocumentModelListsearchGroups(Map<String,Serializable> filter, Set<String> fulltext)Returns groups matching given criteria.DocumentModelListsearchGroups(Map<String,Serializable> filter, Set<String> fulltext, DocumentModel context)Returns groups matching given criteria with the given context.DocumentModelListsearchGroups(QueryBuilder queryBuilder)Returns groups matching the given query.DocumentModelListsearchGroups(QueryBuilder queryBuilder, DocumentModel context)Returns groups matching the given query, within the given context.List<NuxeoPrincipal>searchPrincipals(String pattern)DocumentModelListsearchUsers(String pattern)Returns users matching given patternDocumentModelListsearchUsers(String pattern, DocumentModel context)Returns users matching given pattern with the given context.DocumentModelListsearchUsers(Map<String,Serializable> filter, Set<String> fulltext)Returns users matching given criteria.DocumentModelListsearchUsers(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, DocumentModel context)MULTI-TENANT-IMPLEMENTATIONDocumentModelListsearchUsers(Map<String,Serializable> filter, Set<String> fulltext, DocumentModel context)Returns users matching given criteria and with the given context.DocumentModelListsearchUsers(QueryBuilder queryBuilder)Returns users matching the given query.DocumentModelListsearchUsers(QueryBuilder queryBuilder, DocumentModel context)Returns users matching the given query, within the given context.voidsetConfiguration(UserManagerDescriptor descriptor)Sets the given configuration on the service.protected voidsetGroupDirectoryName(String groupDirectoryName)protected voidsetUserDirectoryName(String userDirectoryName)protected voidsetVirtualUsers(Map<String,VirtualUserDescriptor> virtualUsers)protected voidsyncDigestAuthPassword(String username, String password)voidupdateGroup(DocumentModel groupModel)Updates group represented by given model.voidupdateGroup(DocumentModel groupModel, DocumentModel context)Updates group represented by given model with the given context.voidupdateUser(DocumentModel userModel)Updates user represented by given model.voidupdateUser(DocumentModel userModel, DocumentModel context)Updates user represented by given model into the given context document.protected booleanuseCache()protected booleanuseSearchEscapeCompat()booleanvalidatePassword(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
-
-
-
-
Field Detail
-
SEARCH_ESCAPE_COMPAT_PARAM
protected static final String SEARCH_ESCAPE_COMPAT_PARAM
- Since:
- 11.1
- See Also:
- Constant Field Values
-
USERMANAGER_TOPIC
public static final String USERMANAGER_TOPIC
- See Also:
- Constant Field Values
-
USERCHANGED_EVENT_ID
public static final String USERCHANGED_EVENT_ID
Used by JaasCacheFlusher.- See Also:
- Constant Field Values
-
USERCREATED_EVENT_ID
public static final String USERCREATED_EVENT_ID
- See Also:
- Constant Field Values
-
USERDELETED_EVENT_ID
public static final String USERDELETED_EVENT_ID
- See Also:
- Constant Field Values
-
USERMODIFIED_EVENT_ID
public static final String USERMODIFIED_EVENT_ID
- See Also:
- Constant Field Values
-
GROUPCHANGED_EVENT_ID
public static final String GROUPCHANGED_EVENT_ID
Used by JaasCacheFlusher.- See Also:
- Constant Field Values
-
GROUPCREATED_EVENT_ID
public static final String GROUPCREATED_EVENT_ID
- See Also:
- Constant Field Values
-
GROUPDELETED_EVENT_ID
public static final String GROUPDELETED_EVENT_ID
- See Also:
- Constant Field Values
-
GROUPMODIFIED_EVENT_ID
public static final String GROUPMODIFIED_EVENT_ID
- See Also:
- Constant Field Values
-
DEFAULT_ANONYMOUS_USER_ID
public static final String DEFAULT_ANONYMOUS_USER_ID
- See Also:
- Constant Field Values
-
VIRTUAL_FIELD_FILTER_PREFIX
public static final String VIRTUAL_FIELD_FILTER_PREFIX
- See Also:
- Constant Field Values
-
INVALIDATE_PRINCIPAL_EVENT_ID
public static final String INVALIDATE_PRINCIPAL_EVENT_ID
- See Also:
- Constant Field Values
-
INVALIDATE_ALL_PRINCIPALS_EVENT_ID
public static final String INVALIDATE_ALL_PRINCIPALS_EVENT_ID
- See Also:
- Constant Field Values
-
USER_GROUP_CATEGORY
public static final String USER_GROUP_CATEGORY
Possible value for theDocumentEventContext.CATEGORY_PROPERTY_KEYkey of a core event context.- Since:
- 9.2
- See Also:
- Constant Field Values
-
ID_PROPERTY_KEY
public static final String ID_PROPERTY_KEY
Key for the id of a user or a group in a core event context.- Since:
- 9.2
- See Also:
- Constant Field Values
-
ANCESTOR_GROUPS_PROPERTY_KEY
public static final String ANCESTOR_GROUPS_PROPERTY_KEY
Key for the ancestor group names of a group in a core event context.- Since:
- 9.2
- See Also:
- Constant Field Values
-
USER_HAS_PARTIAL_CONTENT
public static final String USER_HAS_PARTIAL_CONTENT
- Since:
- 11.4
- See Also:
- Constant Field Values
-
dirService
protected final DirectoryService dirService
-
cacheService
protected final CacheService cacheService
-
principalCache
protected Cache principalCache
-
multiTenantManagement
public UserMultiTenantManagement multiTenantManagement
-
userConfig
protected UserConfig userConfig
A structure used to inject field name configuration of users schema into a NuxeoPrincipalImpl instance. TODO not all fields inside are configurable for now - they will use default values
-
groupConfig
protected GroupConfig groupConfig
- Since:
- 9.3
-
userDirectoryName
protected String userDirectoryName
-
userSchemaName
protected String userSchemaName
-
userIdField
protected String userIdField
-
userEmailField
protected String userEmailField
-
userSearchFields
protected Map<String,UserManager.MatchType> userSearchFields
-
groupDirectoryName
protected String groupDirectoryName
-
groupSchemaName
protected String groupSchemaName
-
groupIdField
protected String groupIdField
-
groupLabelField
protected String groupLabelField
-
groupMembersField
protected String groupMembersField
-
groupSubGroupsField
protected String groupSubGroupsField
-
groupParentGroupsField
protected String groupParentGroupsField
-
groupSortField
protected String groupSortField
-
groupSearchFields
protected Map<String,UserManager.MatchType> groupSearchFields
-
defaultGroup
protected String defaultGroup
-
disableDefaultAdministratorsGroup
protected Boolean disableDefaultAdministratorsGroup
-
userSortField
protected String userSortField
-
userListingMode
protected String userListingMode
-
groupListingMode
protected String groupListingMode
-
userPasswordPattern
protected Pattern userPasswordPattern
-
anonymousUser
protected VirtualUser anonymousUser
-
digestAuthDirectory
protected String digestAuthDirectory
-
digestAuthRealm
protected String digestAuthRealm
-
virtualUsers
protected final Map<String,VirtualUserDescriptor> virtualUsers
-
-
Method Detail
-
setConfiguration
public void setConfiguration(UserManagerDescriptor descriptor)
Description copied from interface:UserManagerSets the given configuration on the service.- Specified by:
setConfigurationin interfaceUserManager- Parameters:
descriptor- the descriptor as parsed from xml, merged from the previous one if it exists.
-
setUserDirectoryName
protected void setUserDirectoryName(String userDirectoryName)
-
getUserDirectoryName
public String getUserDirectoryName()
Description copied from interface:UserManagerGets the user directory name.- Specified by:
getUserDirectoryNamein interfaceUserManager- Returns:
- the user directory name.
-
getUserIdField
public String getUserIdField()
Description copied from interface:UserManagerReturns the user directory id field.- Specified by:
getUserIdFieldin interfaceUserManager
-
getUserSchemaName
public String getUserSchemaName()
Description copied from interface:UserManagerReturns the user directory schema name.- Specified by:
getUserSchemaNamein interfaceUserManager
-
getUserEmailField
public String getUserEmailField()
Description copied from interface:UserManagerGets the user email field.- Specified by:
getUserEmailFieldin interfaceUserManager- Returns:
- the user email field.
-
getUserSearchFields
public Set<String> getUserSearchFields()
Description copied from interface:UserManagerGets the user search fields, the fields to use when a principal search is done.- Specified by:
getUserSearchFieldsin interfaceUserManager- Returns:
- the search fields.
-
getGroupSearchFields
public Set<String> getGroupSearchFields()
Description copied from interface:UserManagerGets the group search fields.- Specified by:
getGroupSearchFieldsin interfaceUserManager
-
setGroupDirectoryName
protected void setGroupDirectoryName(String groupDirectoryName)
-
getGroupDirectoryName
public String getGroupDirectoryName()
Description copied from interface:UserManagerGets the group directory name.- Specified by:
getGroupDirectoryNamein interfaceUserManager- Returns:
- the group directory name.
-
getGroupIdField
public String getGroupIdField()
Description copied from interface:UserManagerReturns the group directory id field.- Specified by:
getGroupIdFieldin interfaceUserManager
-
getGroupLabelField
public String getGroupLabelField()
Description copied from interface:UserManagerReturns the group label field.- Specified by:
getGroupLabelFieldin interfaceUserManager
-
getGroupSchemaName
public String getGroupSchemaName()
Description copied from interface:UserManagerReturns the group directory schema name.- Specified by:
getGroupSchemaNamein interfaceUserManager
-
getGroupMembersField
public String getGroupMembersField()
Description copied from interface:UserManagerGets the group members field.- Specified by:
getGroupMembersFieldin interfaceUserManager- Returns:
- the group members field.
-
getGroupSubGroupsField
public String getGroupSubGroupsField()
Description copied from interface:UserManagerGets the group sub-groups field.- Specified by:
getGroupSubGroupsFieldin interfaceUserManager- Returns:
- the sub-groups field.
-
getGroupParentGroupsField
public String getGroupParentGroupsField()
Description copied from interface:UserManagerGets the group parent-groups field.- Specified by:
getGroupParentGroupsFieldin interfaceUserManager- Returns:
- the parent-groups field.
-
getUserListingMode
public String getUserListingMode()
- Specified by:
getUserListingModein interfaceUserManager
-
getGroupListingMode
public String getGroupListingMode()
- Specified by:
getGroupListingModein interfaceUserManager
-
getDefaultGroup
public String getDefaultGroup()
- Specified by:
getDefaultGroupin interfaceUserManager
-
getUserPasswordPattern
public Pattern getUserPasswordPattern()
- Specified by:
getUserPasswordPatternin interfaceUserManager
-
getAnonymousUserId
public String getAnonymousUserId()
Description copied from interface:UserManagerGets the anonymous user id.- Specified by:
getAnonymousUserIdin interfaceUserManager- Returns:
- the anonymous user id, or the default one if none is defined.
-
setVirtualUsers
protected void setVirtualUsers(Map<String,VirtualUserDescriptor> virtualUsers)
-
checkUsernamePassword
public 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- Specified by:
checkUsernamePasswordin interfaceUserManager- Parameters:
username- the usernamepassword- the password to check- Returns:
- true is valid, false otherwise
-
getDigestAuthModel
protected DocumentModel getDigestAuthModel()
-
encodeDigestAuthPassword
public static String encodeDigestAuthPassword(String username, String realm, String password)
-
getDigestAuthDirectory
public String getDigestAuthDirectory()
Description copied from interface:UserManagerGets the Digest Auth directory.- Specified by:
getDigestAuthDirectoryin interfaceUserManager
-
getDigestAuthRealm
public String getDigestAuthRealm()
Description copied from interface:UserManagerGets the Digest Auth realm.- Specified by:
getDigestAuthRealmin interfaceUserManager
-
validatePassword
public boolean validatePassword(String password)
- Specified by:
validatePasswordin interfaceUserManager
-
makeAnonymousPrincipal
protected NuxeoPrincipal makeAnonymousPrincipal()
-
makeVirtualPrincipal
protected NuxeoPrincipal makeVirtualPrincipal(VirtualUser user)
-
makeTransientPrincipal
protected NuxeoPrincipal makeTransientPrincipal(String username)
-
makeVirtualUserEntry
protected DocumentModel makeVirtualUserEntry(String id, VirtualUser user)
-
makePrincipal
protected NuxeoPrincipal makePrincipal(DocumentModel userEntry)
-
makePrincipal
protected NuxeoPrincipal makePrincipal(DocumentModel userEntry, boolean anonymous, List<String> groups)
-
makePrincipal
protected NuxeoPrincipal makePrincipal(DocumentModel userEntry, boolean anonymous, boolean isTransient, List<String> groups)
-
useCache
protected boolean useCache()
-
getPrincipal
public NuxeoPrincipal getPrincipal(String username, boolean fetchReferences)
Description copied from interface:UserManagerRetrieves 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:
getPrincipalin interfaceUserManager- Parameters:
username- is the name of the entry in the user directoryfetchReferences- controls if the references (groups) of the user will be fetched
-
getPrincipalUsingCache
protected NuxeoPrincipal getPrincipalUsingCache(String username)
-
getUserModel
public DocumentModel getUserModel(String userName)
Description copied from interface:UserManagerReturns the document model representing user with given id or null if it does not exist.- Specified by:
getUserModelin interfaceUserManager
-
getBareUserModel
public DocumentModel getBareUserModel()
Description copied from interface:UserManagerReturns a bare user model.Can be used for user creation/search screens.
- Specified by:
getBareUserModelin interfaceUserManager
-
getGroup
public NuxeoGroup getGroup(String groupName)
Description copied from interface:UserManagerReturns the nuxeo group with given name or null if it does not exist.- Specified by:
getGroupin interfaceUserManager
-
getGroup
protected NuxeoGroup getGroup(String groupName, DocumentModel context)
-
getGroupModel
public DocumentModel getGroupModel(String groupName)
Description copied from interface:UserManagerReturn the group document model with this id or null if group does not exist.- Specified by:
getGroupModelin interfaceUserManager- Parameters:
groupName- the group identifier
-
makeGroup
protected NuxeoGroup makeGroup(DocumentModel groupEntry)
-
getTopLevelGroups
public List<String> getTopLevelGroups()
Description copied from interface:UserManagerReturns the list of groups that are not members of other groups.- Specified by:
getTopLevelGroupsin interfaceUserManager
-
getGroupsInGroup
public List<String> getGroupsInGroup(String parentId)
Description copied from interface:UserManagerReturns the list of groups that belong to this group.- Specified by:
getGroupsInGroupin interfaceUserManager- Parameters:
parentId- the name of the parent group.
-
getUsersInGroup
public List<String> getUsersInGroup(String groupId)
Description copied from interface:UserManagerReturns the list of users that belong to this group.- Specified by:
getUsersInGroupin interfaceUserManager- Parameters:
groupId- ID of the group
-
getUsersInGroupAndSubGroups
public List<String> getUsersInGroupAndSubGroups(String groupId)
Description copied from interface:UserManagerGet users from a group and its subgroups.- Specified by:
getUsersInGroupAndSubGroupsin interfaceUserManager- Parameters:
groupId- ID of the group
-
appendSubgroups
protected void appendSubgroups(String groupId, Set<String> groups, DocumentModel context)
-
isAnonymousMatching
protected boolean isAnonymousMatching(Map<String,Serializable> filter, Set<String> fulltext)
-
isAnonymousMatching
protected boolean isAnonymousMatching(QueryBuilder queryBuilder, Directory dir)
-
searchPrincipals
public List<NuxeoPrincipal> searchPrincipals(String pattern)
- Specified by:
searchPrincipalsin interfaceUserManager
-
searchGroups
public DocumentModelList searchGroups(String pattern)
Description copied from interface:UserManagerSearch matching groups through their defined search fields- Specified by:
searchGroupsin interfaceUserManager
-
getUserSortField
public String getUserSortField()
- Specified by:
getUserSortFieldin interfaceUserManager
-
getUserOrderBy
protected OrderByExpr getUserOrderBy()
-
getGroupOrderBy
protected OrderByExpr getGroupOrderBy()
-
getDirectorySortMap
protected Map<String,String> getDirectorySortMap(String descriptorSortField, String fallBackField)
-
notifyCore
protected void notifyCore(String userOrGroupId, String eventId, List<String> ancestorGroupIds)
- Since:
- 9.2
-
notifyUserChanged
public void notifyUserChanged(String userName, String eventId)
Description copied from interface:UserManagerNotifies 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.
- Specified by:
notifyUserChangedin interfaceUserManager
-
invalidatePrincipal
protected void invalidatePrincipal(String userName)
-
notifyGroupChanged
public void notifyGroupChanged(String groupName, String eventId, List<String> ancestorGroupNames)
Description copied from interface:UserManagerNotifies 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 callingUserManager.getAncestorGroups(String). It will be passed as the"ancestorGroups"property of the fired core event.- Specified by:
notifyGroupChangedin interfaceUserManager
-
invalidateAllPrincipals
protected void invalidateAllPrincipals()
-
areGroupsReadOnly
public Boolean areGroupsReadOnly()
Description copied from interface:UserManagerReturns true is users referential is read only (ie : LDAP) -> can not add users -> can not delete users.- Specified by:
areGroupsReadOnlyin interfaceMultiTenantUserManager- Specified by:
areGroupsReadOnlyin interfaceUserManager
-
areUsersReadOnly
public Boolean areUsersReadOnly()
Description copied from interface:UserManagerReturns true is groups referential is read only (ie : LDAP) -> can not add groups -> can not delete groups.- Specified by:
areUsersReadOnlyin interfaceMultiTenantUserManager- Specified by:
areUsersReadOnlyin interfaceUserManager
-
checkGrouId
protected void checkGrouId(DocumentModel groupModel)
-
getGroupId
protected String getGroupId(DocumentModel groupModel)
-
checkUserId
protected void checkUserId(DocumentModel userModel)
-
getUserId
protected String getUserId(DocumentModel userModel)
-
createGroup
public DocumentModel createGroup(DocumentModel groupModel)
Description copied from interface:UserManagerCreates a group from given model- Specified by:
createGroupin interfaceUserManager- Returns:
- the created group model
-
createUser
public DocumentModel createUser(DocumentModel userModel)
Description copied from interface:UserManagerCreates user from given model.- Specified by:
createUserin interfaceUserManager
-
deleteGroup
public void deleteGroup(String groupId)
Description copied from interface:UserManagerDeletes group with given id.- Specified by:
deleteGroupin interfaceUserManager
-
deleteGroup
public void deleteGroup(DocumentModel groupModel)
Description copied from interface:UserManagerDeletes group represented by given model.- Specified by:
deleteGroupin interfaceUserManager
-
deleteUser
public void deleteUser(String userId)
Description copied from interface:UserManagerDeletes user with given id.- Specified by:
deleteUserin interfaceUserManager
-
deleteUser
public void deleteUser(DocumentModel userModel)
Description copied from interface:UserManagerDeletes user represented by given model.- Specified by:
deleteUserin interfaceUserManager
-
getGroupIds
public List<String> getGroupIds()
Description copied from interface:UserManagerReturns the list of all groups ids.- Specified by:
getGroupIdsin interfaceUserManager
-
getUserIds
public List<String> getUserIds()
Description copied from interface:UserManagerReturns the list of all user ids.- Specified by:
getUserIdsin interfaceUserManager
-
removeVirtualFilters
protected void removeVirtualFilters(Map<String,Serializable> filter)
-
getQueryForPattern
protected QueryBuilder getQueryForPattern(String pattern, String dirName, Map<String,UserManager.MatchType> searchFields, OrderByExpr orderBy)
-
searchGroups
public DocumentModelList searchGroups(Map<String,Serializable> filter, Set<String> fulltext)
Description copied from interface:UserManagerReturns groups matching given criteria.- Specified by:
searchGroupsin interfaceUserManager- Parameters:
filter- filter with field names as keysfulltext- field names used for fulltext match
-
searchGroups
public DocumentModelList searchGroups(QueryBuilder queryBuilder)
Description copied from interface:UserManagerReturns groups matching the given query.- Specified by:
searchGroupsin interfaceUserManager- Parameters:
queryBuilder- the query to use, including limit, offset, ordering and countTotal
-
searchUsers
public DocumentModelList searchUsers(String pattern)
Description copied from interface:UserManagerReturns 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:
searchUsersin interfaceUserManager
-
searchUsers
public DocumentModelList searchUsers(Map<String,Serializable> filter, Set<String> fulltext)
Description copied from interface:UserManagerReturns users matching given criteria.- Specified by:
searchUsersin interfaceUserManager- Parameters:
filter- filter with field names as keysfulltext- field names used for fulltext match
-
searchUsers
public DocumentModelList searchUsers(QueryBuilder queryBuilder)
Description copied from interface:UserManagerReturns users matching the given query.- Specified by:
searchUsersin interfaceUserManager- Parameters:
queryBuilder- the query to use, including limit, offset, ordering and countTotal
-
updateGroup
public void updateGroup(DocumentModel groupModel)
Description copied from interface:UserManagerUpdates group represented by given model.- Specified by:
updateGroupin interfaceUserManager
-
updateUser
public void updateUser(DocumentModel userModel)
Description copied from interface:UserManagerUpdates user represented by given model.- Specified by:
updateUserin interfaceUserManager
-
getBareGroupModel
public DocumentModel getBareGroupModel()
Description copied from interface:UserManagerReturns a bare group model.Can be used for group creation/search screens.
- Specified by:
getBareGroupModelin interfaceUserManager
-
getAdministratorsGroups
public List<String> getAdministratorsGroups()
Description copied from interface:UserManagerReturns the list of administrators groups.- Specified by:
getAdministratorsGroupsin interfaceAdministratorGroupsProvider- Specified by:
getAdministratorsGroupsin interfaceUserManager
-
getUsersForPermission
public String[] getUsersForPermission(String perm, ACP acp)
Description copied from interface:UserManagerFor 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:
getUsersForPermissionin interfaceUserManager- Parameters:
perm- the permissionacp- The access control policy of the document- Returns:
- the list of user ids
-
authenticate
public Principal authenticate(String name, String password)
Description copied from interface:AuthenticatorGet 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:
authenticatein interfaceAuthenticator- Returns:
- the authenticated principal if authentication succeded otherwise null
-
searchUsers
public DocumentModelList searchUsers(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, DocumentModel context)
MULTI-TENANT-IMPLEMENTATION
-
getUsersInGroup
public List<String> getUsersInGroup(String groupId, DocumentModel context)
Description copied from interface:MultiTenantUserManagerReturns the list of users that belong to this group into the given context- Specified by:
getUsersInGroupin interfaceMultiTenantUserManager- Parameters:
groupId- ID of the group
-
searchUsers
public DocumentModelList searchUsers(String pattern, DocumentModel context)
Description copied from interface:MultiTenantUserManagerReturns users matching given pattern with the given context. if the Document Context have a directory local configuration, the service try to open the directory with directory suffix set into the local configurationPattern 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:
searchUsersin interfaceMultiTenantUserManager
-
searchUsers
public DocumentModelList searchUsers(QueryBuilder queryBuilder, DocumentModel context)
Description copied from interface:MultiTenantUserManagerReturns users matching the given query, within the given context.- Specified by:
searchUsersin interfaceMultiTenantUserManager- Parameters:
queryBuilder- the query to use, including limit, offset, ordering and countTotalcontext- the context for the tenant, ornull
-
queryWithVirtualEntries
protected DocumentModelList queryWithVirtualEntries(Session session, QueryBuilder queryBuilder, List<DocumentModel> virtualEntries)
Executes a query then adds virtual entries (already supposed to match the query). Then does limit/offset/order/countTotal.- Since:
- 10.3
-
searchUsers
public DocumentModelList searchUsers(Map<String,Serializable> filter, Set<String> fulltext, DocumentModel context)
Description copied from interface:MultiTenantUserManagerReturns users matching given criteria and with the given context. if the Document Context have a directory local configuration, the service try to open the user directory with directory suffix set into the local configuration- Specified by:
searchUsersin interfaceMultiTenantUserManager- Parameters:
filter- filter with field names as keysfulltext- field names used for fulltext match
-
getGroupIds
public List<String> getGroupIds(DocumentModel context)
Description copied from interface:MultiTenantUserManagerReturns the list of all groups ids with the given context. if the Document Context have a directory local configuration, the service try to open the user directory with directory suffix set into the local configuration- Specified by:
getGroupIdsin interfaceMultiTenantUserManager
-
searchGroups
public DocumentModelList searchGroups(Map<String,Serializable> filter, Set<String> fulltext, DocumentModel context)
Description copied from interface:MultiTenantUserManagerReturns groups matching given criteria with the given context. if the Document Context have a directory local configuration, the service try to open the user directory with directory suffix set into the local configuration- Specified by:
searchGroupsin interfaceMultiTenantUserManager- Parameters:
filter- filter with field names as keysfulltext- field names used for fulltext match
-
searchGroups
public DocumentModelList searchGroups(QueryBuilder queryBuilder, DocumentModel context)
Description copied from interface:MultiTenantUserManagerReturns groups matching the given query, within the given context.- Specified by:
searchGroupsin interfaceMultiTenantUserManager- Parameters:
queryBuilder- the query to use, including limit, offset, ordering and countTotalcontext- the context for the tenant, ornull
-
createGroup
public DocumentModel createGroup(DocumentModel groupModel, DocumentModel context) throws GroupAlreadyExistsException
Description copied from interface:MultiTenantUserManagerCreates a group from given model with the given context. If the Document Context have a directory local configuration, the service will append at the end of the groupname the directory suffix set into the local configuration of the context document.- Specified by:
createGroupin interfaceMultiTenantUserManager- Returns:
- the created group model
- Throws:
GroupAlreadyExistsException
-
getGroupModel
public DocumentModel getGroupModel(String groupIdValue, DocumentModel context)
Description copied from interface:MultiTenantUserManagerReturn the group document model with this id concatenated with the directory local config (if not null) or null if group does not exist.- Specified by:
getGroupModelin interfaceMultiTenantUserManager- Parameters:
groupIdValue- the group identifier
-
getUserModel
public DocumentModel getUserModel(String userName, DocumentModel context)
Description copied from interface:MultiTenantUserManagerReturns the document model representing user with given id or null if it does not exist into the given context document. The context document must be contained into the tenant.- Specified by:
getUserModelin interfaceMultiTenantUserManager
-
getUserModel
protected DocumentModel getUserModel(String userName, DocumentModel context, boolean fetchReferences)
-
cloneMap
protected Map<String,Serializable> cloneMap(Map<String,Serializable> map)
-
getPrincipal
public NuxeoPrincipal getPrincipal(String username, DocumentModel context)
Description copied from interface:MultiTenantUserManagerRetrieves the principal with the given username or null if it does not exist into the given context document. The context document must be contained into the tenantCan build principals for anonymous and virtual users as well as for users defined in the users directory.
- Specified by:
getPrincipalin interfaceMultiTenantUserManager
-
getPrincipal
protected NuxeoPrincipal getPrincipal(String username, DocumentModel context, boolean fetchReferences)
-
searchGroups
public DocumentModelList searchGroups(String pattern, DocumentModel context)
Description copied from interface:MultiTenantUserManagerSearch matching groups through their defined search fields into the given context document. The context document must be contained into the tenant.- Specified by:
searchGroupsin interfaceMultiTenantUserManager
-
getUserIds
public List<String> getUserIds(DocumentModel context)
Description copied from interface:MultiTenantUserManagerReturns the list of all user ids into the given context document. The context document must be contained into the tenant.- Specified by:
getUserIdsin interfaceMultiTenantUserManager
-
createUser
public DocumentModel createUser(DocumentModel userModel, DocumentModel context) throws UserAlreadyExistsException
Description copied from interface:MultiTenantUserManagerCreates user from given model into the given context document. The context document must be contained into the tenant.- Specified by:
createUserin interfaceMultiTenantUserManager- Throws:
UserAlreadyExistsException
-
checkGroupsExistence
protected void checkGroupsExistence(DocumentModel userModel, String schema, DocumentModel context)
-
checkPasswordValidity
protected void checkPasswordValidity(DocumentModel userModel) throws InvalidPasswordException
- Throws:
InvalidPasswordException
-
updateUser
public void updateUser(DocumentModel userModel, DocumentModel context)
Description copied from interface:MultiTenantUserManagerUpdates user represented by given model into the given context document. The context document must be contained into the tenant.- Specified by:
updateUserin interfaceMultiTenantUserManager
-
useSearchEscapeCompat
protected boolean useSearchEscapeCompat()
-
deleteUser
public void deleteUser(DocumentModel userModel, DocumentModel context)
Description copied from interface:MultiTenantUserManagerDeletes user represented by given model into the given context document. The context document must be contained into the tenant.- Specified by:
deleteUserin interfaceMultiTenantUserManager
-
deleteUser
public void deleteUser(String userId, DocumentModel context)
Description copied from interface:MultiTenantUserManagerDeletes user with given id into the given context document. The context document must be contained into the tenant.- Specified by:
deleteUserin interfaceMultiTenantUserManager
-
updateGroup
public void updateGroup(DocumentModel groupModel, DocumentModel context)
Description copied from interface:MultiTenantUserManagerUpdates group represented by given model with the given context. If the Document Context have a directory local configuration, the service will append at the end of the groupname the directory suffix set into the local configuration of the context document.- Specified by:
updateGroupin interfaceMultiTenantUserManager
-
deleteGroup
public void deleteGroup(DocumentModel groupModel, DocumentModel context)
Description copied from interface:MultiTenantUserManagerDeletes group represented by given model with the given context. If the Document Context have a directory local configuration, the service will append at the end of the groupname the directory suffix set into the local configuration of the context document.- Specified by:
deleteGroupin interfaceMultiTenantUserManager
-
deleteGroup
public void deleteGroup(String groupId, DocumentModel context)
Description copied from interface:MultiTenantUserManagerDeletes group with given id with the given context. If the Document Context have a directory local configuration, the service will append at the end of the groupname the directory suffix set into the local configuration of the context document.- Specified by:
deleteGroupin interfaceMultiTenantUserManager
-
getGroupsInGroup
public List<String> getGroupsInGroup(String parentId, DocumentModel context)
Description copied from interface:MultiTenantUserManagerReturns the list of groups that belong to this group with the given context. If the Document Context have a directory local configuration, the service will append at the end of the groupname the directory suffix set into the local configuration of the context document.- Specified by:
getGroupsInGroupin interfaceMultiTenantUserManager- Parameters:
parentId- the name of the parent group.
-
getTopLevelGroups
public List<String> getTopLevelGroups(DocumentModel context)
Description copied from interface:MultiTenantUserManagerReturns the list of groups that are not members of other groups with the given context.- Specified by:
getTopLevelGroupsin interfaceMultiTenantUserManager
-
getUsersInGroupAndSubGroups
public List<String> getUsersInGroupAndSubGroups(String groupId, DocumentModel context)
Description copied from interface:MultiTenantUserManagerGet users from a group and its subgroups into the given context- Specified by:
getUsersInGroupAndSubGroupsin interfaceMultiTenantUserManager- Parameters:
groupId- ID of the group
-
getUsersForPermission
public String[] getUsersForPermission(String perm, ACP acp, DocumentModel context)
Description copied from interface:MultiTenantUserManagerFor an ACP, get the list of user that has a permission into the given context. This method should be use with care as it can cause performance issues while getting the list of users.- Specified by:
getUsersForPermissionin interfaceMultiTenantUserManager- Parameters:
perm- the permissionacp- The access control policy of the document- Returns:
- the list of user ids
-
getAncestorGroups
public List<String> getAncestorGroups(String groupId)
Description copied from interface:UserManagerReturns the ancestor groups of the group with the given id.- Specified by:
getAncestorGroupsin interfaceUserManager
-
populateAncestorGroups
protected void populateAncestorGroups(String groupId, List<String> ancestorGroups)
-
getDescendantGroups
public List<String> getDescendantGroups(String groupId)
Description copied from interface:UserManagerReturns the descendant groups of the group with the given id.- Specified by:
getDescendantGroupsin interfaceUserManager
-
populateDescendantGroups
protected void populateDescendantGroups(String groupId, List<String> descendantGroups)
-
getGroupConfig
public GroupConfig getGroupConfig()
Description copied from interface:UserManagerReturns the contributedGroupConfig.- Specified by:
getGroupConfigin interfaceUserManager
-
handleEvent
public void handleEvent(Event event)
Description copied from interface:EventListenerAn event was received.- Specified by:
handleEventin interfaceEventListener
-
-