@Transactional(propagation=REQUIRED) public abstract class UserManagementBase extends Object implements UserManagement
Spring Service base class for com.communote.server.service.user.UserManagement,
provides access to all services and entities referenced by this service.
UserManagementUserManagement.RegistrationTypeANONYMIZE_USER_PREFIX| Constructor and Description |
|---|
UserManagementBase() |
| 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 |
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 emailConfirmation,
boolean managerConfirmation)
Create a user based on the parameters.
|
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 username)
find user by email or alias
|
User |
findUserByExternalUserId(String externalUserId,
String systemId)
Find the user by the external system specification
|
User |
findUserByUserId(Long userId)
Find a user by the its id.
|
long |
getActiveUserCount() |
protected Principal |
getPrincipal()
Gets the current
principal if one has been set, otherwise returns
null. |
UserRole[] |
getRolesOfUser(Long userId)
Returns the roles of a user.
|
protected abstract void |
handleAcceptTermsOfUse(Long userId) |
protected abstract void |
handleAnonymizeUser(Long userId,
Long[] blogIds,
boolean becomeManager)
Performs the core logic for
anonymizeUser(Long, Long[], boolean) |
protected abstract User |
handleAssignUserRole(Long userId,
UserRole role)
Performs the core logic for
assignUserRole(Long, UserRole) |
protected abstract boolean |
handleChangeEmailAddress(Long userId,
String newEmail,
boolean sendConfirmationLink)
Performs the core logic for
#changeEmailAddress(Long, String) |
protected abstract void |
handleChangeUserStatusByManager(Long userId,
UserStatus newStatus) |
protected abstract void |
handleConfirmNewEmailAddress(String securityCode)
Performs the core logic for
confirmNewEmailAddress(String) |
protected abstract User |
handleConfirmUser(String securitycode,
UserVO user)
Performs the core logic for
confirmUser(String, UserVO) |
protected abstract User |
handleCreateOrUpdateExternalUser(ExternalUserVO userVO)
Performs the core logic for
createOrUpdateExternalUser(ExternalUserVO) |
protected abstract User |
handleCreateUser(UserVO user,
boolean emailConfirmation,
boolean managerConfirmation)
Performs the core logic for
createUser(UserVO, boolean, boolean) |
protected abstract User |
handleFindUserByAlias(String alias)
Performs the core logic for
findUserByAlias(String) |
protected abstract User |
handleFindUserByEmail(String email)
Performs the core logic for
findUserByEmail(String) |
protected abstract User |
handleFindUserByEmailAlias(String username)
Performs the core logic for
#findKenmeiUserByEmailAlias(String) |
protected abstract User |
handleFindUserByExternalUserId(String externalUserId,
String systemId)
Performs the core logic for
findUserByExternalUserId(String, String) |
protected abstract long |
handleGetActiveUserCount()
Performs the core logic for
getActiveUserCount() |
protected abstract UserRole[] |
handleGetRolesOfUser(Long userId)
Performs the core logic for
getRolesOfUser(Long) |
protected abstract User |
handleInviteUserToBlog(Long blogId,
UserVO userData,
BlogRole role)
Performs the core logic for
#inviteUserToBlog(Long, User, UserVO, com.communote.server.model.blog.BlogRole) |
protected abstract User |
handleInviteUserToClient(UserVO user)
Performs the core logic for
#inviteUserToClient(User, UserVO) |
protected abstract void |
handlePermanentlyDisableUser(Long userId,
Long[] blogIds,
boolean becomeManager)
Performs the core logic for
permanentlyDisableUser(Long, Long[], boolean) |
protected abstract User |
handleRegisterUser(String email,
Locale locale,
UserManagement.RegistrationType type)
Performs the core logic for
#registerUser(String, java.util.Locale) |
protected abstract User |
handleRemoveUserRole(Long userId,
UserRole role)
Performs the core logic for
removeUserRole(Long, UserRole) |
protected abstract void |
handleResetPermanentId(String systemId)
Performs the core logic for
#resetExternalUserId(String) |
protected abstract User |
handleUnlockUser(String securityCode)
Performs the core logic for
unlockUser(String) |
protected abstract User |
handleUpdateExternalUser(ExternalUserVO userVO)
Performs the core logic for
updateExternalUser(ExternalUserVO) |
protected abstract void |
handleUpdateLanguage(Long userId,
String languageCode)
Performs the core logic for
updateLanguage(Long, String) |
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.
|
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
|
User |
unlockUser(String securityCode)
Unlocks the user for the given security code.
|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitchangeAlias, findNotDeletedUsers, findUser, findUser, findUserByUserId, findUsersByRole, generateUniqueAlias, getActiveUserCount, getExternalExternalUserAuthentications, getUserById, hasExternalAuthentication, registerActivationValidator, resetTermsOfUse, sendReminderMails, unregisterActivationValidator, updateUserTagspublic void acceptTermsOfUse(Long userId) throws UserNotFoundException, AuthorizationException, UserActivationValidationException
UserManagementacceptTermsOfUse in interface UserManagementuserId - ID of the user whose ID should be acceptedUserNotFoundException - in case the user with the given ID does not existAuthorizationException - in case there is a current user which is not the internal system user and this
user does not have the provided IDUserActivationValidationException - in case the user has status TERMS_NOT_ACCEPTED but cannot be
activated after accepting the termspublic void anonymizeUser(Long userId, Long[] blogIds, boolean becomeManager) throws AuthorizationException, NoClientManagerLeftException, UserDeletionDisabledException, NoBlogManagerLeftException
anonymizeUser in interface UserManagementuserId - 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.public User assignUserRole(Long userId, UserRole role) throws AuthorizationException, InvalidOperationException
UserManagementassignUserRole in interface UserManagementuserId - 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 rolepublic boolean changeEmailAddress(Long userId, String newEmail, boolean sendConfirmationLink) throws EmailValidationException, EmailAlreadyExistsException
changeEmailAddress in interface UserManagementuserId - 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.EmailValidationExceptionEmailAlreadyExistsExceptionpublic void changeUserStatusByManager(Long userId, UserStatus newStatus) throws AuthorizationException, UserNotFoundException, InvalidUserStatusTransitionException, NoClientManagerLeftException, UserActivationValidationException
UserManagement
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
UserManagement.anonymizeUser(Long, Long[], boolean) or
UserManagement.permanentlyDisableUser(Long, Long[], boolean).
changeUserStatusByManager in interface UserManagementuserId - 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_DISABLEDNoClientManagerLeftException - in case the user to change is the only client manager with status
ACTIVE and the new status is not ACTIVEUserActivationValidationException - in case the user cannot be activatedpublic void confirmNewEmailAddress(String securityCode) throws SecurityCodeNotFoundException, EmailAlreadyExistsException
UserManagementconfirmNewEmailAddress in interface UserManagementsecurityCode - The security code.SecurityCodeNotFoundExceptionEmailAlreadyExistsExceptionpublic User confirmUser(String securitycode, UserVO user) throws SecurityCodeNotFoundException, EmailValidationException, EmailAlreadyExistsException, AliasAlreadyExistsException, PasswordValidationException, InvalidUserStatusTransitionException, ExternalUserPasswordChangeNotAllowedException
UserManagementConfirms a registered or invited user, sets user data and change status to active or confirmed.
public User createOrUpdateExternalUser(ExternalUserVO userVO) throws EmailValidationException, EmailAlreadyExistsException, AliasAlreadyExistsException, InvalidUserStatusTransitionException, UserActivationValidationException, NoClientManagerLeftException, PermanentIdMissmatchException
UserManagementcreateOrUpdateExternalUser in interface UserManagementuserVO - VO with details of the user to createEmailValidationException - in case the email address is not validEmailAlreadyExistsException - in case the email address is already assigned to another userAliasAlreadyExistsException - in case the alias is already assigned to another userInvalidUserStatusTransitionException - in case the user exists and the old status of that user cannot be updated with
the new statusUserActivationValidationException - in case the user cannot be updatedNoClientManagerLeftException - in case the user exists and is the only active client manager and the new status
is not ACTIVEPermanentIdMissmatchExceptionpublic User createUser(UserVO user, boolean emailConfirmation, boolean managerConfirmation) throws EmailAlreadyExistsException, EmailValidationException, AliasAlreadyExistsException, PasswordValidationException
UserManagementcreateUser in interface UserManagementuser - the VO describing the user to createemailConfirmation - whether the user should confirm the provided email address. If true a confirmation
email will be sent to the email address.managerConfirmation - 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 requirements@Transactional(readOnly=true) public User findUserByAlias(String alias)
UserManagementfindUserByAlias in interface UserManagementalias - the alias@Transactional(readOnly=true) public User findUserByEmail(String email)
UserManagementfindUserByEmail in interface UserManagementemail - address to search for.@Transactional(readOnly=true) public User findUserByEmailAlias(String username)
UserManagementfindUserByEmailAlias in interface UserManagementusername - May be a user alias or email address@Transactional(readOnly=true) public User findUserByExternalUserId(String externalUserId, String systemId)
UserManagementFind the user by the external system specification
findUserByExternalUserId in interface UserManagementUserManagement.findUserByExternalUserId(String, String)@Transactional(readOnly=true) public User findUserByUserId(Long userId)
UserManagement.findUserByUserId(Long, boolean) if you need this information or better
UserManagement.getUserById(Long, Converter).findUserByUserId in interface UserManagementuserId - Id of the user to find.@Transactional(readOnly=true) public long getActiveUserCount()
getActiveUserCount in interface UserManagementUserManagement.getActiveUserCount()protected Principal getPrincipal()
principal if one has been set, otherwise returns
null.@Transactional(readOnly=true) public UserRole[] getRolesOfUser(Long userId)
UserManagementgetRolesOfUser in interface UserManagementuserId - If of the user to get the roles for.UserManagement.getRolesOfUser(Long)protected abstract void handleAcceptTermsOfUse(Long userId) throws UserNotFoundException, AuthorizationException, UserActivationValidationException
protected abstract void handleAnonymizeUser(Long userId, Long[] blogIds, boolean becomeManager) throws AuthorizationException, NoClientManagerLeftException, UserDeletionDisabledException, NoBlogManagerLeftException
anonymizeUser(Long, Long[], boolean)protected abstract User handleAssignUserRole(Long userId, UserRole role) throws AuthorizationException, InvalidOperationException
assignUserRole(Long, UserRole)AuthorizationException - in case the current user is not a client managerInvalidOperationException - in case the user is already a system or a crawl user or the role to assign is the
system or crawl user roleprotected abstract boolean handleChangeEmailAddress(Long userId, String newEmail, boolean sendConfirmationLink) throws EmailValidationException, EmailAlreadyExistsException
#changeEmailAddress(Long, String)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.EmailValidationExceptionEmailAlreadyExistsExceptionprotected abstract void handleChangeUserStatusByManager(Long userId, UserStatus newStatus) throws UserActivationValidationException, InvalidUserStatusTransitionException, UserNotFoundException, NoClientManagerLeftException
protected abstract void handleConfirmNewEmailAddress(String securityCode) throws SecurityCodeNotFoundException, EmailAlreadyExistsException
confirmNewEmailAddress(String)protected abstract User handleConfirmUser(String securitycode, UserVO user) throws SecurityCodeNotFoundException, EmailValidationException, EmailAlreadyExistsException, AliasAlreadyExistsException, PasswordValidationException, InvalidUserStatusTransitionException, ExternalUserPasswordChangeNotAllowedException
confirmUser(String, UserVO)protected abstract User handleCreateOrUpdateExternalUser(ExternalUserVO userVO) throws EmailValidationException, EmailAlreadyExistsException, AliasAlreadyExistsException, InvalidUserStatusTransitionException, UserActivationValidationException, NoClientManagerLeftException, PermanentIdMissmatchException
createOrUpdateExternalUser(ExternalUserVO)protected abstract User handleCreateUser(UserVO user, boolean emailConfirmation, boolean managerConfirmation) throws EmailAlreadyExistsException, EmailValidationException, AliasAlreadyExistsException, PasswordValidationException
createUser(UserVO, boolean, boolean)protected abstract User handleFindUserByAlias(String alias)
findUserByAlias(String)protected abstract User handleFindUserByEmail(String email)
findUserByEmail(String)protected abstract User handleFindUserByEmailAlias(String username)
#findKenmeiUserByEmailAlias(String)protected abstract User handleFindUserByExternalUserId(String externalUserId, String systemId)
findUserByExternalUserId(String, String)protected abstract long handleGetActiveUserCount()
getActiveUserCount()protected abstract UserRole[] handleGetRolesOfUser(Long userId)
getRolesOfUser(Long)protected abstract User handleInviteUserToBlog(Long blogId, UserVO userData, BlogRole role) throws AliasAlreadyExistsException, EmailValidationException, EmailAlreadyExistsException, PermanentIdMissmatchException, BlogAccessException, AuthorizationException
#inviteUserToBlog(Long, User, UserVO, com.communote.server.model.blog.BlogRole)BlogAccessException - in case the current user is not allowed to add the userAuthorizationException - in case there is no current userAliasAlreadyExistsExceptionEmailValidationExceptionEmailAlreadyExistsExceptionPermanentIdMissmatchExceptionprotected abstract User handleInviteUserToClient(UserVO user) throws EmailValidationException, EmailAlreadyExistsException, AliasAlreadyExistsException, PermanentIdMissmatchException, AuthorizationException
#inviteUserToClient(User, UserVO)protected abstract void handlePermanentlyDisableUser(Long userId, Long[] blogIds, boolean becomeManager) throws AuthorizationException, NoClientManagerLeftException, UserDeletionDisabledException, InvalidUserStatusTransitionException, NoBlogManagerLeftException
permanentlyDisableUser(Long, Long[], boolean)protected abstract User handleRegisterUser(String email, Locale locale, UserManagement.RegistrationType type) throws EmailValidationException, EmailAlreadyExistsException
#registerUser(String, java.util.Locale)type - EmailValidationExceptionEmailAlreadyExistsExceptionprotected abstract User handleRemoveUserRole(Long userId, UserRole role) throws AuthorizationException, InvalidOperationException, NoClientManagerLeftException
removeUserRole(Long, UserRole)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
roleprotected abstract void handleResetPermanentId(String systemId) throws AuthorizationException
#resetExternalUserId(String)AuthorizationExceptionprotected abstract User handleUnlockUser(String securityCode) throws SecurityCodeNotFoundException
unlockUser(String)SecurityCodeNotFoundExceptionprotected abstract User handleUpdateExternalUser(ExternalUserVO userVO) throws AliasAlreadyExistsException, EmailAlreadyExistsException, EmailValidationException, InvalidUserStatusTransitionException, NoClientManagerLeftException, PermanentIdMissmatchException, UserActivationValidationException
updateExternalUser(ExternalUserVO)protected abstract void handleUpdateLanguage(Long userId, String languageCode)
updateLanguage(Long, String)public User inviteUserToBlog(Long blogId, UserVO userData, BlogRole role) throws AliasAlreadyExistsException, EmailValidationException, EmailAlreadyExistsException, PermanentIdMissmatchException, AuthorizationException
inviteUserToBlog in interface UserManagementBlogAccessException - in case the current user is not allowed to invite a userAuthorizationException - in case there is no current userAliasAlreadyExistsExceptionEmailValidationExceptionEmailAlreadyExistsExceptionPermanentIdMissmatchExceptionpublic User inviteUserToClient(UserVO user) throws EmailValidationException, EmailAlreadyExistsException, AliasAlreadyExistsException, PermanentIdMissmatchException, AuthorizationException
inviteUserToClient in interface UserManagementEmailValidationExceptionEmailAlreadyExistsExceptionAliasAlreadyExistsExceptionPermanentIdMissmatchExceptionAuthorizationExceptionpublic 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.
public User registerUser(String email, Locale locale, UserManagement.RegistrationType type) throws EmailValidationException, EmailAlreadyExistsException
registerUser in interface UserManagementemail - 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.public User removeUserRole(Long userId, UserRole role) throws AuthorizationException, InvalidOperationException, NoClientManagerLeftException
UserManagementremoveUserRole in interface UserManagementAuthorizationException - in case the current user is not client managerInvalidOperationException - in case the user is a system or crawl user and the system or crawl user role
should be removedNoClientManagerLeftException - in case the client manager role should be removed from the last user with that
rolepublic void resetPermanentId(String systemId) throws AuthorizationException
UserManagementresets the external user ID for users that have an external authentication which has the provided external system ID and a permanentId
resetPermanentId in interface UserManagementAuthorizationExceptionUserManagement#resetExternalUserId(String)public User unlockUser(String securityCode) throws SecurityCodeNotFoundException
unlockUser in interface UserManagementsecurityCode - The code, which user should be unlocked.SecurityCodeNotFoundException - Thrown, when the code doesn't exist.public User updateExternalUser(ExternalUserVO userVO) throws AliasAlreadyExistsException, EmailAlreadyExistsException, EmailValidationException, UserActivationValidationException, InvalidUserStatusTransitionException, NoClientManagerLeftException, PermanentIdMissmatchException
UserManagementupdateExternalUser in interface UserManagementuserVO - 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 validUserActivationValidationException - in case the user cannot be activatedInvalidUserStatusTransitionException - 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
ACTIVEPermanentIdMissmatchExceptionpublic void updateLanguage(Long userId, String languageCode)
updateLanguage in interface UserManagementuserId - The user to update.languageCode - The language to set.Copyright © 2019 Communote team. All rights reserved.