public interface UserManagement
Modifier and Type | Interface and Description |
---|---|
static class |
UserManagement.RegistrationType
Possible registration types.
|
Modifier and Type | Field and Description |
---|---|
static String |
ANONYMIZE_USER_PREFIX
Prefix for user aliases for anonymized users.
|
Modifier and Type | Method and Description |
---|---|
void |
acceptTermsOfUse(Long userId)
Accept the terms of use for the given user.
|
void |
anonymizeUser(Long userId,
Long[] blogIds,
boolean becomeManager)
Delete a user by anonymizing his profile and removing the content (notes, topics if possible)
he created.
|
User |
assignUserRole(Long userId,
UserRole role)
Assign the user role to the user
|
boolean |
changeAlias(Long userId,
String newAlias)
Method to change the users alias.
|
boolean |
changeEmailAddress(Long userId,
String newEmail,
boolean sendConfirmationLink)
Changes the email address of an user and validates this new address.
|
void |
changeUserStatusByManager(Long userId,
UserStatus newStatus)
Change the status of a user.
|
void |
confirmNewEmailAddress(String securityCode)
Confirms the new email address.
|
User |
confirmUser(String securitycode,
UserVO user)
Confirms a registered or invited user, sets user data and change status to active or
confirmed.
|
User |
createOrUpdateExternalUser(ExternalUserVO userVO)
Creates or updates a user with data retrieved from a external user repository (e.g.
|
User |
createUser(UserVO user,
boolean emailConfirmationRequired,
boolean managerConfirmationRequired)
Create a user based on the parameters.
|
Collection<User> |
findNotDeletedUsers(boolean excludeSystemUsers)
Returns a collection with all users that do not have one of the deleted statuses.
|
User |
findUser(UserIdentification userIdentification)
Find the User by the given identification, not loading the
ExternalUserAuthentication
s |
User |
findUser(UserIdentification userIdentification,
boolean loadExternalAuthentications)
Find the User by the given identification
|
User |
findUserByAlias(String alias)
Find the User by the given alias s
|
User |
findUserByEmail(String email)
Find a user by the email address
|
User |
findUserByEmailAlias(String emailOrAlias)
find user by email or alias
|
User |
findUserByExternalUserId(String externalUserId,
String systemId)
Find the user by the external system specification
|
User |
findUserByUserId(Long userId)
Deprecated.
Use
getUserById(Long, Converter) instead. |
User |
findUserByUserId(Long userId,
boolean loadExternalAuthentications)
Find a user by the its id.
|
List<User> |
findUsersByRole(UserRole userRole,
UserStatus status)
Returns a collection of users having a specific role and optionally a specific status.
|
String |
generateUniqueAlias(String externalUserName,
String emailAddress)
Create a valid, not yet used, user alias.
|
long |
getActiveUserCount() |
long |
getActiveUserCount(String systemId,
UserRole role)
Get the number of users with status ACTIVE.
|
Set<ExternalUserAuthentication> |
getExternalExternalUserAuthentications(long userId) |
UserRole[] |
getRolesOfUser(Long userId)
Returns the roles of a user.
|
<T> T |
getUserById(Long userId,
Converter<User,T> converter)
Return the details of a user.
|
boolean |
hasExternalAuthentication(long userId,
String externalSystemId) |
User |
inviteUserToBlog(Long blogId,
UserVO userData,
BlogRole role) |
User |
inviteUserToClient(UserVO user) |
void |
permanentlyDisableUser(Long userId,
Long[] blogIds,
boolean becomeManager)
Deletes a user by setting his status to PERMANENTLY_DISABLED but keeping all his data.
|
void |
registerActivationValidator(UserActivationValidator validator)
Register a validator that will be called before the status of a user is set to
ACTIVE . |
User |
registerUser(String email,
Locale locale,
UserManagement.RegistrationType type)
Method to register an user via email address.
|
User |
removeUserRole(Long userId,
UserRole role)
Remove a role from a user
|
void |
resetPermanentId(String systemId)
resets the external user ID for users that have an external authentication which has the
provided external system ID and a permanentId
|
void |
resetTermsOfUse()
Reset the terms of use for all users which have already accepted the terms of use.
|
void |
sendReminderMails() |
User |
unlockUser(String securityCode)
Unlocks the user for the given security code.
|
void |
unregisterActivationValidator(UserActivationValidator validator)
Unregister a previously registered validator.
|
User |
updateExternalUser(ExternalUserVO userVO)
Tries to update a user with data retrieved from an external resource (e.g.
|
void |
updateLanguage(Long userId,
String languageCode)
Sets the language of the given user to the given language.
|
void |
updateUserTags(Long userId,
Set<TagTO> tags)
Updates the tags of the given user.
|
static final String ANONYMIZE_USER_PREFIX
void acceptTermsOfUse(Long userId) throws AuthorizationException, UserNotFoundException, UserActivationValidationException
userId
- ID of the user whose ID should be acceptedAuthorizationException
- in case there is a current user which is not the internal system user and this
user does not have the provided IDUserNotFoundException
- in case the user with the given ID does not existUserActivationValidationException
- in case the user has status TERMS_NOT_ACCEPTED
but cannot be
activated after accepting the termsvoid anonymizeUser(Long userId, Long[] blogIds, boolean becomeManager) throws AuthorizationException, NoClientManagerLeftException, UserDeletionDisabledException, NoBlogManagerLeftException
userId
- ID of the user to removeblogIds
- an array of IDs of topics in which the user to remove is the only manager. If the
current user is not a client manager this parameter is ignored.becomeManager
- whether the current user, which has to be a client manager, should become manager
of the topics identified by the IDs in blogIds array. If false the topics will be
deleted.AuthorizationException
- in case the current user is not a client manager or the user to removeNoClientManagerLeftException
- in case the user to delete is the last active client managerUserDeletionDisabledException
- in case the anonymization of users is disabled and the current user is not a
client managerNoBlogManagerLeftException
- in case there are topics which are managed by the user to remove and have
additional users with read access but no other managers. If the current user is
client manager this exception will only be thrown if the IDs of the topics are
not in the blogIds array. The exception will contain the IDs of the topics that
would become manager-less.User assignUserRole(Long userId, UserRole role) throws AuthorizationException, InvalidOperationException
userId
- the id of the userrole
- the role to assignAuthorizationException
- in case the current user is not a client manager and thus not allowedInvalidOperationException
- in case the user is already a system or a crawl user or the role to assign is the
system or crawl user roleboolean changeAlias(Long userId, String newAlias) throws AliasAlreadyExistsException, AliasInvalidException
userId
- The users id.newAlias
- The new alias.AliasAlreadyExistsException
- Thrown, when there is already a user with this alias.AliasInvalidException
- Thrown, when the alias is syntactically invalid.boolean changeEmailAddress(Long userId, String newEmail, boolean sendConfirmationLink) throws EmailValidationException, EmailAlreadyExistsException
userId
- Id of the user, which email should be changed.newEmail
- The new email address.sendConfirmationLink
- If true an confirmation link will be send to the user to confirm the new address.
False is only possible, if the current use an administrator.EmailValidationException
EmailAlreadyExistsException
void changeUserStatusByManager(Long userId, UserStatus newStatus) throws AuthorizationException, UserNotFoundException, InvalidUserStatusTransitionException, NoClientManagerLeftException, UserActivationValidationException
Note: Attempts to set the user status to DELETED
or
PERMANENTLY_DISABLED
will result in an InvalidUserStatusTransitionException.
Such a status change can only be achieved by invoking the appropriate service methods
anonymizeUser(Long, Long[], boolean)
or
permanentlyDisableUser(Long, Long[], boolean)
.
userId
- the ID of the user whose status should be changednewStatus
- the new status to setAuthorizationException
- in case the current user is not a client managerUserNotFoundException
- in case there is no user with the provided IDInvalidUserStatusTransitionException
- in case new status cannot be set. This will for example happen if the it is one
of DELETED
or PERMANENTLY_DISABLED
NoClientManagerLeftException
- in case the user to change is the only client manager with status
ACTIVE
and the new status is not ACTIVE
UserActivationValidationException
- in case the user cannot be activatedvoid confirmNewEmailAddress(String securityCode) throws SecurityCodeNotFoundException, EmailAlreadyExistsException
securityCode
- The security code.SecurityCodeNotFoundException
EmailAlreadyExistsException
User confirmUser(String securitycode, UserVO user) throws SecurityCodeNotFoundException, EmailValidationException, EmailAlreadyExistsException, AliasAlreadyExistsException, PasswordValidationException, InvalidUserStatusTransitionException, ExternalUserPasswordChangeNotAllowedException
Confirms a registered or invited user, sets user data and change status to active or confirmed.
User createOrUpdateExternalUser(ExternalUserVO userVO) throws AliasAlreadyExistsException, EmailValidationException, EmailAlreadyExistsException, UserActivationValidationException, InvalidUserStatusTransitionException, NoClientManagerLeftException, PermanentIdMissmatchException
userVO
- VO with details of the user to createAliasAlreadyExistsException
- in case the alias is already assigned to another userEmailAlreadyExistsException
- in case the email address is already assigned to another userEmailValidationException
- in case the email address is not validInvalidUserStatusTransitionException
- in case the user exists and the old status of that user cannot be updated with
the new statusNoClientManagerLeftException
- in case the user exists and is the only active client manager and the new status
is not ACTIVEUserActivationValidationException
- in case the user cannot be updatedPermanentIdMissmatchException
User createUser(UserVO user, boolean emailConfirmationRequired, boolean managerConfirmationRequired) throws EmailAlreadyExistsException, EmailValidationException, AliasAlreadyExistsException, PasswordValidationException
user
- the VO describing the user to createemailConfirmationRequired
- whether the user should confirm the provided email address. If true a confirmation
email will be sent to the email address.managerConfirmationRequired
- whether a client manager has to confirm and activate the user. If true the
managers will be performed by email about the new user.EmailAlreadyExistsException
- in case the provided email address already existsEmailValidationException
- in case the provided email address is not validAliasAlreadyExistsException
- in case the provided user alias already existsPasswordValidationException
- in case the provided password does not meet the minimum security requirementsCollection<User> findNotDeletedUsers(boolean excludeSystemUsers)
excludeSystemUsers
- whether to exclude the users who have the system user roleUser findUser(UserIdentification userIdentification)
ExternalUserAuthentication
suserIdentification
- the identificationUser findUser(UserIdentification userIdentification, boolean loadExternalAuthentications)
userIdentification
- the identificationloadExternalAuthentications
- true if the external auths of the user should be loaded as wellUser findUserByAlias(String alias)
alias
- the aliasUser findUserByEmail(String email)
email
- address to search for.User findUserByEmailAlias(String emailOrAlias)
emailOrAlias
- May be a user alias or email addressUser findUserByExternalUserId(String externalUserId, String systemId)
Find the user by the external system specification
@Deprecated User findUserByUserId(Long userId)
getUserById(Long, Converter)
instead.findUserByUserId(Long, boolean)
if you need this information or better
getUserById(Long, Converter)
.userId
- Id of the user to find.User findUserByUserId(Long userId, boolean loadExternalAuthentications)
getUserById(Long, Converter)
instead.userId
- Id of the user to find.loadExternalAuthentications
- true to load the external authentications of the userList<User> findUsersByRole(UserRole userRole, UserStatus status)
String generateUniqueAlias(String externalUserName, String emailAddress)
externalUserName
- the external user name to try first. Can be null.emailAddress
- the email address to extract the alias fromlong getActiveUserCount()
long getActiveUserCount(String systemId, UserRole role)
systemId
- ID of an external system to only count the users which originate from this
external system. If null, all user are counted.role
- the role of a user. If not null only the users with that role will be counted
otherwise all roles (including system users) are considered.@Transactional(readOnly=true) Set<ExternalUserAuthentication> getExternalExternalUserAuthentications(long userId)
userId
- The users id.UserRole[] getRolesOfUser(Long userId)
userId
- If of the user to get the roles for.<T> T getUserById(Long userId, Converter<User,T> converter)
T
- the type of the resulting objectuserId
- the ID of the userconverter
- the converter to use@Transactional(readOnly=true) boolean hasExternalAuthentication(long userId, String externalSystemId)
userId
- The users id.externalSystemId
- ID of an external systemUser inviteUserToBlog(Long blogId, UserVO userData, BlogRole role) throws AliasAlreadyExistsException, EmailValidationException, EmailAlreadyExistsException, PermanentIdMissmatchException, BlogAccessException, AuthorizationException
BlogAccessException
- in case the current user is not allowed to invite a userAuthorizationException
- in case there is no current userAliasAlreadyExistsException
EmailValidationException
EmailAlreadyExistsException
PermanentIdMissmatchException
User inviteUserToClient(UserVO user) throws EmailValidationException, EmailAlreadyExistsException, AliasAlreadyExistsException, PermanentIdMissmatchException, AuthorizationException
void permanentlyDisableUser(Long userId, Long[] blogIds, boolean becomeManager) throws AuthorizationException, NoClientManagerLeftException, UserDeletionDisabledException, InvalidUserStatusTransitionException, NoBlogManagerLeftException
Deletes a user by setting his status to PERMANENTLY_DISABLED but keeping all his data.
void registerActivationValidator(UserActivationValidator validator)
ACTIVE
. The validators are executed in the order defined by the
Orderable
implementation. If the first validator throws an exception the validation
will be stopped.validator
- the validator to addUser registerUser(String email, Locale locale, UserManagement.RegistrationType type) throws EmailValidationException, EmailAlreadyExistsException
email
- The users email address.locale
- The locale to use for the confirmation email.type
- The type of the registration.EmailValidationException
- Thrown, when the email address is not syntactically valid.EmailAlreadyExistsException
- Thrown, when the email/user address already exists.User removeUserRole(Long userId, UserRole role) throws AuthorizationException, InvalidOperationException, NoClientManagerLeftException
InvalidOperationException
- in case the user is a system or crawl user and the system or crawl user role
should be removedAuthorizationException
- in case the current user is not client managerNoClientManagerLeftException
- in case the client manager role should be removed from the last user with that
rolevoid resetPermanentId(String systemId) throws AuthorizationException
resets the external user ID for users that have an external authentication which has the provided external system ID and a permanentId
AuthorizationException
void resetTermsOfUse() throws AuthorizationException
AuthorizationException
- in case the current user is not client manager or internal system uservoid sendReminderMails()
User unlockUser(String securityCode) throws SecurityCodeNotFoundException
securityCode
- The code, which user should be unlocked.SecurityCodeNotFoundException
- Thrown, when the code doesn't exist.void unregisterActivationValidator(UserActivationValidator validator)
validator
- the validator to removeUser updateExternalUser(ExternalUserVO userVO) throws AliasAlreadyExistsException, EmailAlreadyExistsException, EmailValidationException, InvalidUserStatusTransitionException, NoClientManagerLeftException, PermanentIdMissmatchException, UserActivationValidationException
userVO
- a VO with data to update the user withAliasAlreadyExistsException
- in case the new alias is already assigned to another userEmailAlreadyExistsException
- in case the new email address is already assigned to another userEmailValidationException
- in case the new email address is not validInvalidUserStatusTransitionException
- in case the old status of the user cannot be updated with the new statusNoClientManagerLeftException
- in case the user is the only active client manager and the new status is not
ACTIVEPermanentIdMissmatchException
UserActivationValidationException
- in case the user cannot be activatedvoid updateLanguage(Long userId, String languageCode)
userId
- The user to update.languageCode
- The language to set.Copyright © 2019 Communote team. All rights reserved.