Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.platform.usermanager.ejb
Class UserManagerBean

java.lang.Object
  extended by org.nuxeo.ecm.platform.usermanager.ejb.UserManagerBean
All Implemented Interfaces:
java.io.Serializable, UserManagerLocal, UserManager

public class UserManagerBean
extends java.lang.Object
implements UserManagerLocal

Author:
George Lefter
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.nuxeo.ecm.platform.usermanager.UserManager
UserManager.MatchType
 
Constructor Summary
UserManagerBean()
           
 
Method Summary
 java.lang.Boolean areGroupsReadOnly()
          Returns true is users referential is read only (ie : LDAP) -> can not add users -> can not delete users.
 java.lang.Boolean areUsersReadOnly()
          Returns true is groups referential is read only (ie : LDAP) -> can not add groups -> can not delete groups.
 boolean checkUsernamePassword(java.lang.String username, java.lang.String password)
           
 void cleanup()
           
 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(java.lang.String groupId)
          Deletes group with given id.
 void deletePrincipal(NuxeoPrincipal principal)
           
 void deleteUser(DocumentModel userModel)
          Deletes user represented by given model.
 void deleteUser(java.lang.String userId)
          Deletes user with given id.
 java.util.List<java.lang.String> getAdministratorsGroups()
          Returns the list of administrators groups.
 java.lang.String getAnonymousUserId()
          Gets the anonymous user id.
 java.util.List<NuxeoGroup> getAvailableGroups()
           
 java.util.List<NuxeoPrincipal> getAvailablePrincipals()
           
 DocumentModel getBareGroupModel()
          Returns a bare group model.
 DocumentModel getBareUserModel()
          Returns a bare user model.
 java.lang.String getDefaultGroup()
           
 NuxeoGroup getGroup(java.lang.String groupName)
          Returns the nuxeo group with given name or null if it does not exist.
 java.lang.String getGroupDirectoryName()
          Gets the group directory name.
 java.lang.String getGroupIdField()
          Returns the group directory id field.
 java.util.List<java.lang.String> getGroupIds()
          Returns the list of all groups ids.
 java.lang.String getGroupListingMode()
           
 java.lang.String getGroupMembersField()
          Gets the group members field.
 DocumentModel getGroupModel(java.lang.String groupName)
          Return the group document model with this id or null if group does not exist.
 java.lang.String getGroupParentGroupsField()
          Gets the group parent-groups field.
 java.lang.String getGroupSchemaName()
          Returns the group directory schema name.
 java.util.List<java.lang.String> getGroupsInGroup(java.lang.String parentId)
          Returns the list of groups that belong to this group.
 java.lang.String getGroupSubGroupsField()
          Gets the group sub-groups field.
 DocumentModel getModelForUser(java.lang.String name)
           
 NuxeoPrincipal getPrincipal(java.lang.String username)
          Retrieves the principal with the given username or null if it does not exist.
 java.util.List<java.lang.String> getTopLevelGroups()
          Returns the list of groups that are not members of other groups.
 java.lang.String getUserDirectoryName()
          Gets the user directory name.
 java.lang.String getUserEmailField()
          Gets the user email field.
 java.lang.String getUserIdField()
          Returns the user directory id field.
 java.util.List<java.lang.String> getUserIds()
          Returns the list of all user ids.
 java.lang.String getUserListingMode()
           
 DocumentModel getUserModel(java.lang.String userName)
          Returns the document model representing user with given id or null if it does not exist.
 java.util.regex.Pattern getUserPasswordPattern()
           
 java.lang.String getUserSchemaName()
          Returns the user directory schema name.
 java.util.Set<java.lang.String> getUserSearchFields()
          Gets the user search fields, the fields to use when a principal search is done.
 java.util.List<java.lang.String> getUsersInGroup(java.lang.String groupId)
          Returns the list of users that belong to this group.
 java.util.List<java.lang.String> getUsersInGroupAndSubGroups(java.lang.String groupId)
          Get users from a group and its subgroups.
 java.lang.String getUserSortField()
           
 void initialize()
           
 java.util.List<NuxeoPrincipal> searchByMap(java.util.Map<java.lang.String,java.io.Serializable> filter, java.util.Set<java.lang.String> pattern)
           
 DocumentModelList searchGroups(java.util.Map<java.lang.String,java.io.Serializable> filter, java.util.HashSet<java.lang.String> fulltext)
          Returns groups matching given criteria.
 java.util.List<NuxeoGroup> searchGroups(java.lang.String pattern)
           
 java.util.List<NuxeoPrincipal> searchPrincipals(java.lang.String name)
           
 DocumentModelList searchUsers(java.util.Map<java.lang.String,java.io.Serializable> filter, java.util.Set<java.lang.String> fulltext)
          Returns users matching given criteria.
 DocumentModelList searchUsers(java.lang.String pattern)
          Returns users matching given pattern Pattern is used to fill a filter and fulltext map according to users search fields configuration.
 void setConfiguration(UserManagerDescriptor descriptor)
          Sets the given configuration on the service.
 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(java.lang.String password)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserManagerBean

public UserManagerBean()
Method Detail

initialize

@PostConstruct
public void initialize()
Specified by:
initialize in interface UserManagerLocal

cleanup

public void cleanup()

checkUsernamePassword

public boolean checkUsernamePassword(java.lang.String username,
                                     java.lang.String password)
                              throws ClientException
Specified by:
checkUsernamePassword in interface UserManager
Throws:
ClientException

validatePassword

public boolean validatePassword(java.lang.String password)
                         throws ClientException
Specified by:
validatePassword in interface UserManager
Throws:
ClientException

getPrincipal

public NuxeoPrincipal getPrincipal(java.lang.String username)
                            throws ClientException
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 interface UserManager
Throws:
ClientException

searchPrincipals

public java.util.List<NuxeoPrincipal> searchPrincipals(java.lang.String name)
                                                throws ClientException
Specified by:
searchPrincipals in interface UserManager
Throws:
ClientException

searchGroups

public java.util.List<NuxeoGroup> searchGroups(java.lang.String pattern)
                                        throws ClientException
Specified by:
searchGroups in interface UserManager
Throws:
ClientException

getGroup

public NuxeoGroup getGroup(java.lang.String groupName)
                    throws ClientException
Description copied from interface: UserManager
Returns the nuxeo group with given name or null if it does not exist.

Specified by:
getGroup in interface UserManager
Throws:
ClientException

getDefaultGroup

public java.lang.String getDefaultGroup()
Specified by:
getDefaultGroup in interface UserManager

getUserSortField

public java.lang.String getUserSortField()
                                  throws ClientException
Specified by:
getUserSortField in interface UserManager
Throws:
ClientException

getUserListingMode

public java.lang.String getUserListingMode()
                                    throws ClientException
Specified by:
getUserListingMode in interface UserManager
Throws:
ClientException

getGroupListingMode

public java.lang.String getGroupListingMode()
                                     throws ClientException
Specified by:
getGroupListingMode in interface UserManager
Throws:
ClientException

getUserDirectoryName

public java.lang.String getUserDirectoryName()
                                      throws ClientException
Description copied from interface: UserManager
Gets the user directory name.

Specified by:
getUserDirectoryName in interface UserManager
Returns:
the user directory name.
Throws:
ClientException

getUserEmailField

public java.lang.String getUserEmailField()
                                   throws ClientException
Description copied from interface: UserManager
Gets the user email field.

Specified by:
getUserEmailField in interface UserManager
Returns:
the user email field.
Throws:
ClientException

getUserSearchFields

public java.util.Set<java.lang.String> getUserSearchFields()
                                                    throws ClientException
Description copied from interface: UserManager
Gets the user search fields, the fields to use when a principal search is done.

Specified by:
getUserSearchFields in interface UserManager
Returns:
the search fields.
Throws:
ClientException

getGroupDirectoryName

public java.lang.String getGroupDirectoryName()
                                       throws ClientException
Description copied from interface: UserManager
Gets the group directory name.

Specified by:
getGroupDirectoryName in interface UserManager
Returns:
the group directory name.
Throws:
ClientException

getGroupMembersField

public java.lang.String getGroupMembersField()
                                      throws ClientException
Description copied from interface: UserManager
Gets the group members field.

Specified by:
getGroupMembersField in interface UserManager
Returns:
the group members field.
Throws:
ClientException

getGroupSubGroupsField

public java.lang.String getGroupSubGroupsField()
                                        throws ClientException
Description copied from interface: UserManager
Gets the group sub-groups field.

Specified by:
getGroupSubGroupsField in interface UserManager
Returns:
the sub-groups field.
Throws:
ClientException

getGroupParentGroupsField

public java.lang.String getGroupParentGroupsField()
                                           throws ClientException
Description copied from interface: UserManager
Gets the group parent-groups field.

Specified by:
getGroupParentGroupsField in interface UserManager
Returns:
the parent-groups field.
Throws:
ClientException

getGroupsInGroup

public java.util.List<java.lang.String> getGroupsInGroup(java.lang.String parentId)
                                                  throws ClientException
Description copied from interface: UserManager
Returns the list of groups that belong to this group.

Specified by:
getGroupsInGroup in interface UserManager
Parameters:
parentId - the name of the parent group.
Returns:
Throws:
ClientException

getTopLevelGroups

public java.util.List<java.lang.String> getTopLevelGroups()
                                                   throws ClientException
Description copied from interface: UserManager
Returns the list of groups that are not members of other groups.

Specified by:
getTopLevelGroups in interface UserManager
Returns:
Throws:
ClientException

getUsersInGroup

public java.util.List<java.lang.String> getUsersInGroup(java.lang.String groupId)
                                                 throws ClientException
Description copied from interface: UserManager
Returns the list of users that belong to this group.

Specified by:
getUsersInGroup in interface UserManager
Parameters:
groupId - ID of the group
Returns:
Throws:
ClientException

getUsersInGroupAndSubGroups

public java.util.List<java.lang.String> getUsersInGroupAndSubGroups(java.lang.String groupId)
                                                             throws ClientException
Description copied from interface: UserManager
Get users from a group and its subgroups.

Specified by:
getUsersInGroupAndSubGroups in interface UserManager
Parameters:
groupId - ID of the group
Returns:
Throws:
ClientException

areGroupsReadOnly

public java.lang.Boolean areGroupsReadOnly()
                                    throws ClientException
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 interface UserManager
Throws:
ClientException

areUsersReadOnly

public java.lang.Boolean areUsersReadOnly()
                                   throws ClientException
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 interface UserManager
Throws:
ClientException

getUserPasswordPattern

public java.util.regex.Pattern getUserPasswordPattern()
                                               throws ClientException
Specified by:
getUserPasswordPattern in interface UserManager
Throws:
ClientException

getAnonymousUserId

public java.lang.String getAnonymousUserId()
                                    throws ClientException
Description copied from interface: UserManager
Gets the anonymous user id.

Specified by:
getAnonymousUserId in interface UserManager
Returns:
the anonymous user id, or the default one if none is defined.
Throws:
ClientException

setConfiguration

public void setConfiguration(UserManagerDescriptor descriptor)
                      throws ClientException
Description copied from interface: UserManager
Sets the given configuration on the service.

Specified by:
setConfiguration in interface UserManager
Parameters:
descriptor - the descriptor as parsed from xml, merged from the previous one if it exists.
Throws:
ClientException

getBareUserModel

public DocumentModel getBareUserModel()
                               throws ClientException
Description copied from interface: UserManager
Returns a bare user model.

Can be used for user creation/search screens.

Specified by:
getBareUserModel in interface UserManager
Throws:
ClientException

createGroup

public DocumentModel createGroup(DocumentModel groupModel)
                          throws ClientException
Description copied from interface: UserManager
Creates a group from given model.

Specified by:
createGroup in interface UserManager
Returns:
the created group model
Throws:
ClientException
GroupAlreadyExistsException

createUser

public DocumentModel createUser(DocumentModel userModel)
                         throws ClientException
Description copied from interface: UserManager
Creates user from given model.

Specified by:
createUser in interface UserManager
Throws:
ClientException
UserAlreadyExistsException

deleteGroup

public void deleteGroup(DocumentModel groupModel)
                 throws ClientException
Description copied from interface: UserManager
Deletes group represented by given model.

Specified by:
deleteGroup in interface UserManager
Throws:
ClientException

deleteUser

public void deleteUser(DocumentModel userModel)
                throws ClientException
Description copied from interface: UserManager
Deletes user represented by given model.

Specified by:
deleteUser in interface UserManager
Throws:
ClientException

getBareGroupModel

public DocumentModel getBareGroupModel()
                                throws ClientException
Description copied from interface: UserManager
Returns a bare group model.

Can be used for group creation/search screens.

Specified by:
getBareGroupModel in interface UserManager
Throws:
ClientException

getGroupIds

public java.util.List<java.lang.String> getGroupIds()
                                             throws ClientException
Description copied from interface: UserManager
Returns the list of all groups ids.

Specified by:
getGroupIds in interface UserManager
Throws:
ClientException

getUserIds

public java.util.List<java.lang.String> getUserIds()
                                            throws ClientException
Description copied from interface: UserManager
Returns the list of all user ids.

Specified by:
getUserIds in interface UserManager
Throws:
ClientException

searchGroups

public DocumentModelList searchGroups(java.util.Map<java.lang.String,java.io.Serializable> filter,
                                      java.util.HashSet<java.lang.String> fulltext)
                               throws ClientException
Description copied from interface: UserManager
Returns groups matching given criteria.

Specified by:
searchGroups in interface UserManager
Parameters:
filter - filter with field names as keys
fulltext - field names used for fulltext match
Throws:
ClientException

searchUsers

public DocumentModelList searchUsers(java.util.Map<java.lang.String,java.io.Serializable> filter,
                                     java.util.Set<java.lang.String> fulltext)
                              throws ClientException
Description copied from interface: UserManager
Returns users matching given criteria.

Specified by:
searchUsers in interface UserManager
Parameters:
filter - filter with field names as keys
fulltext - field names used for fulltext match
Throws:
ClientException

searchUsers

public DocumentModelList searchUsers(java.lang.String pattern)
                              throws ClientException
Description copied from interface: UserManager
Returns users matching given pattern

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).

Specified by:
searchUsers in interface UserManager
Throws:
ClientException

updateGroup

public void updateGroup(DocumentModel groupModel)
                 throws ClientException
Description copied from interface: UserManager
Updates group represented by given model.

Specified by:
updateGroup in interface UserManager
Throws:
ClientException

updateUser

public void updateUser(DocumentModel userModel)
                throws ClientException
Description copied from interface: UserManager
Updates user represented by given model.

Specified by:
updateUser in interface UserManager
Throws:
ClientException

deleteGroup

public void deleteGroup(java.lang.String groupId)
                 throws ClientException
Description copied from interface: UserManager
Deletes group with given id.

Specified by:
deleteGroup in interface UserManager
Throws:
ClientException

deleteUser

public void deleteUser(java.lang.String userId)
                throws ClientException
Description copied from interface: UserManager
Deletes user with given id.

Specified by:
deleteUser in interface UserManager
Throws:
ClientException

getGroupModel

public DocumentModel getGroupModel(java.lang.String groupName)
                            throws ClientException
Description copied from interface: UserManager
Return the group document model with this id or null if group does not exist.

Specified by:
getGroupModel in interface UserManager
Parameters:
groupName - the group identifier
Throws:
ClientException

getUserModel

public DocumentModel getUserModel(java.lang.String userName)
                           throws ClientException
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 interface UserManager
Throws:
ClientException

getGroupIdField

public java.lang.String getGroupIdField()
                                 throws ClientException
Description copied from interface: UserManager
Returns the group directory id field.

Specified by:
getGroupIdField in interface UserManager
Throws:
ClientException

getGroupSchemaName

public java.lang.String getGroupSchemaName()
                                    throws ClientException
Description copied from interface: UserManager
Returns the group directory schema name.

Specified by:
getGroupSchemaName in interface UserManager
Throws:
ClientException

getUserIdField

public java.lang.String getUserIdField()
                                throws ClientException
Description copied from interface: UserManager
Returns the user directory id field.

Specified by:
getUserIdField in interface UserManager
Throws:
ClientException

getUserSchemaName

public java.lang.String getUserSchemaName()
                                   throws ClientException
Description copied from interface: UserManager
Returns the user directory schema name.

Specified by:
getUserSchemaName in interface UserManager
Throws:
ClientException

createGroup

public void createGroup(NuxeoGroup group)
                 throws ClientException
Specified by:
createGroup in interface UserManager
Throws:
ClientException

createPrincipal

public void createPrincipal(NuxeoPrincipal principal)
                     throws ClientException
Specified by:
createPrincipal in interface UserManager
Throws:
ClientException

deleteGroup

public void deleteGroup(NuxeoGroup group)
                 throws ClientException
Specified by:
deleteGroup in interface UserManager
Throws:
ClientException

deletePrincipal

public void deletePrincipal(NuxeoPrincipal principal)
                     throws ClientException
Specified by:
deletePrincipal in interface UserManager
Throws:
ClientException

getAvailableGroups

public java.util.List<NuxeoGroup> getAvailableGroups()
                                              throws ClientException
Specified by:
getAvailableGroups in interface UserManager
Throws:
ClientException

getAvailablePrincipals

public java.util.List<NuxeoPrincipal> getAvailablePrincipals()
                                                      throws ClientException
Specified by:
getAvailablePrincipals in interface UserManager
Throws:
ClientException

getModelForUser

public DocumentModel getModelForUser(java.lang.String name)
                              throws ClientException
Specified by:
getModelForUser in interface UserManager
Throws:
ClientException

searchByMap

public java.util.List<NuxeoPrincipal> searchByMap(java.util.Map<java.lang.String,java.io.Serializable> filter,
                                                  java.util.Set<java.lang.String> pattern)
                                           throws ClientException
Specified by:
searchByMap in interface UserManager
Throws:
ClientException

updateGroup

public void updateGroup(NuxeoGroup group)
                 throws ClientException
Specified by:
updateGroup in interface UserManager
Throws:
ClientException

updatePrincipal

public void updatePrincipal(NuxeoPrincipal principal)
                     throws ClientException
Specified by:
updatePrincipal in interface UserManager
Throws:
ClientException

getAdministratorsGroups

public java.util.List<java.lang.String> getAdministratorsGroups()
Description copied from interface: UserManager
Returns the list of administrators groups.

Specified by:
getAdministratorsGroups in interface UserManager

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.