public interface UserHandler
Modifier and Type | Method and Description |
---|---|
void |
addUserEventListener(UserEventListener listener)
This method is used to register an user event listener
|
boolean |
authenticate(String username,
String password)
Check if the username and the password of an user is valid.
|
void |
createUser(User user,
boolean broadcast)
This method is used to persist a new user object.
|
User |
createUserInstance()
Deprecated.
This method create an User instance that implement the User
interface. The user instance is not persisted yet
|
User |
createUserInstance(String username)
This method create an User instance that implement the User interface.
|
ListAccess<User> |
findAllUsers()
This method is used to get all the users in the database
This method is equivalent to
findAllUsers(UserStatus.ENABLED) |
ListAccess<User> |
findAllUsers(org.exoplatform.services.organization.UserStatus status)
This method is used to get all the users in the database
|
User |
findUserByName(String userName) |
User |
findUserByName(String userName,
org.exoplatform.services.organization.UserStatus status) |
org.exoplatform.commons.utils.PageList<User> |
findUsers(org.exoplatform.services.organization.Query query)
Deprecated.
use
findUsersByQuery(Query) instead |
org.exoplatform.commons.utils.PageList<User> |
findUsersByGroup(String groupId)
Deprecated.
use
findUsersByGroupId(String) instead |
ListAccess<User> |
findUsersByGroupId(String groupId)
This method should search and return the list of the users in a given
group.
|
ListAccess<User> |
findUsersByGroupId(String groupId,
org.exoplatform.services.organization.UserStatus status)
This method should search and return the list of the users in a given
group.
|
ListAccess<User> |
findUsersByQuery(org.exoplatform.services.organization.Query query)
This method search for the users according to a search criteria, the query
This method is equivalent to
findUsersByQuery(query, UserStatus.ENABLED) |
ListAccess<User> |
findUsersByQuery(org.exoplatform.services.organization.Query query,
org.exoplatform.services.organization.UserStatus status)
This method search for the users according to a search criteria, the query
|
org.exoplatform.commons.utils.PageList<User> |
getUserPageList(int pageSize)
Deprecated.
use
findAllUsers() instead |
default boolean |
isUpdateLastLoginTime()
Determines whether the API should update the Last Login time after
authentication or not.
|
User |
removeUser(String userName,
boolean broadcast)
Remove an user and broadcast the event to all the registered listener.
|
void |
removeUserEventListener(UserEventListener listener)
This method is used to unregister an user event listener
|
void |
saveUser(User user,
boolean broadcast)
This method is used to update an existing User object
|
User |
setEnabled(String userName,
boolean enabled,
boolean broadcast)
Enables/Disables the given user.
|
User createUserInstance()
User createUserInstance(String username)
username
- Name of the user to use for a new user instance.void createUser(User user, boolean broadcast) throws Exception
user
- The user object to savebroadcast
- If the broadcast value is true , then the UserHandler
should broadcast the event to all the listener that register with
the organization service. For example, the portal service register
an user event listener with the organization service. when a new
account is created, a portal configuration should be created for
the new user account at the same time. In this case the portal
user event listener will be called in the createUser method.Exception
- The exception can be thrown if the UserHandler
cannot persist the user object or any listeners fail to handle
the user event.void saveUser(User user, boolean broadcast) throws Exception, org.exoplatform.services.organization.DisabledUserException
user
- The user object to updatebroadcast
- If the broadcast is true , then all the user event
listener that register with the organization service will be
calledException
- The exception can be thrown if the UserHandler
cannot save the user object or any listeners fail to handle the
user event.org.exoplatform.services.organization.DisabledUserException
- in case the target user account is disabled
or an other exception prevents to check if the user account is disabledUser removeUser(String userName, boolean broadcast) throws Exception
userName
- The user should be removed from the user databasebroadcast
- If broadcast is true, the delete user event should be
broadcasted to all registered listenerException
- The exception can be thrown if the user could not
be removed or any listeners fail to handle the
user event.User setEnabled(String userName, boolean enabled, boolean broadcast) throws Exception, UnsupportedOperationException
userName
- the user name corresponding to the user account
that we would like to enable/disableenabled
- if set to true
the user will be enabled, otherwise
it will be disabledbroadcast
- If broadcast is true, the setEnabled user event should be
broadcasted to all registered listenernull
if the user could not be found.Exception
- The exception can be thrown if we could not
enable or disable the user or any listeners fail to handle the
user event.UnsupportedOperationException
- in case the implementation doesn't support
such type of operation.User findUserByName(String userName) throws Exception
userName
- the user that the user handler should search for. This
method is equivalent to findUserByName(userName, UserStatus.ENABLED)
Exception
- The exception is thrown if the method fail to access the
user database or more than one user object with the same username
is foundUser findUserByName(String userName, org.exoplatform.services.organization.UserStatus status) throws Exception
userName
- the user that the user handler should search forstatus
- indicates the expected status of the users.
If set to UserStatus.ENABLED
only enabled users will be returned.null
if there is no user that matches the
given username or the user found doesn't match with the expected UserStatus
.
The method return an User object if an user matches the
username.Exception
- The exception is thrown if the method fail to access the
user database or more than one user object with the same username
is found@Deprecated org.exoplatform.commons.utils.PageList<User> findUsersByGroup(String groupId) throws Exception
findUsersByGroupId(String)
insteadgroupId
- id of the group. The return users list should be in this
groupException
ListAccess<User> findUsersByGroupId(String groupId) throws Exception
findUsersByGroupId(groupId, UserStatus.ENABLED)
groupId
- id of the group. The return users list should be in this
groupException
- any exceptionListAccess<User> findUsersByGroupId(String groupId, org.exoplatform.services.organization.UserStatus status) throws Exception
groupId
- id of the group. The return users list should be in this
groupstatus
- indicates the expected status of the users.
If set to UserStatus.ENABLED
only enabled users will be returned.Exception
- any exception@Deprecated org.exoplatform.commons.utils.PageList<User> getUserPageList(int pageSize) throws Exception
findAllUsers()
insteadpageSize
- The number of user in each pageException
ListAccess<User> findAllUsers() throws Exception
findAllUsers(UserStatus.ENABLED)
Exception
- any exceptionListAccess<User> findAllUsers(org.exoplatform.services.organization.UserStatus status) throws Exception
status
- indicates the expected status of the users.
If set to UserStatus.ENABLED
only enabled users will be returned.Exception
- any exception@Deprecated org.exoplatform.commons.utils.PageList<User> findUsers(org.exoplatform.services.organization.Query query) throws Exception
findUsersByQuery(Query)
insteadquery
- The query object contains the search criteria.Exception
- throw exception if the service cannot access the databaseListAccess<User> findUsersByQuery(org.exoplatform.services.organization.Query query) throws Exception
findUsersByQuery(query, UserStatus.ENABLED)
query
- The query object contains the search criteria.Exception
- throw exception if the service cannot access the databaseListAccess<User> findUsersByQuery(org.exoplatform.services.organization.Query query, org.exoplatform.services.organization.UserStatus status) throws Exception
query
- The query object contains the search criteria.status
- indicates the expected status of the users.
If set to UserStatus.ENABLED
only enabled users will be returned.Exception
- throw exception if the service cannot access the databaseboolean authenticate(String username, String password) throws Exception, org.exoplatform.services.organization.DisabledUserException
username
- the name of user to authenticatepassword
- the password of user to authenticateException
- throw an exception if cannot access the databaseorg.exoplatform.services.organization.DisabledUserException
- in case the target user account is disabled
or an other exception prevents to check if the user account is disableddefault boolean isUpdateLastLoginTime()
void addUserEventListener(UserEventListener listener)
listener
- the user event listener to registervoid removeUserEventListener(UserEventListener listener)
listener
- the user event listener to unregisterCopyright © 2003–2019 eXo Platform SAS. All rights reserved.