@Service(value="userManagement") public class UserManagementImpl extends UserManagementBase
UserManagement
. UserManagement.RegistrationType
ANONYMIZE_USER_PREFIX
Constructor and Description |
---|
UserManagementImpl() |
Modifier and Type | Method and Description |
---|---|
boolean |
changeAlias(Long userId,
String newAlias)
Method to change the users alias.
|
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 |
findUserByUserId(Long userId,
boolean loadExternalAuthentications)
Find a user by the its id.
|
List<User> |
findUsersByRole(UserRole role,
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(String systemId,
UserRole role)
Get the number of users with status ACTIVE.
|
Set<ExternalUserAuthentication> |
getExternalExternalUserAuthentications(long userId) |
<T> T |
getUserById(Long userId,
Converter<User,T> converter)
Return the details of a user.
|
protected void |
handleAcceptTermsOfUse(Long userId) |
protected void |
handleAnonymizeUser(Long userId,
Long[] blogIds,
boolean becomeManager)
Performs the core logic for
UserManagementBase.anonymizeUser(Long, Long[], boolean) |
protected User |
handleAssignUserRole(Long userId,
UserRole role)
Performs the core logic for
UserManagementBase.assignUserRole(Long, UserRole) |
protected boolean |
handleChangeEmailAddress(Long userId,
String newEmail,
boolean sendConfirmationEmail)
Performs the core logic for
#changeEmailAddress(Long, String) |
protected void |
handleChangeUserStatusByManager(Long userId,
UserStatus newStatus) |
protected void |
handleConfirmNewEmailAddress(String securityCode)
Performs the core logic for
UserManagementBase.confirmNewEmailAddress(String) |
protected User |
handleConfirmUser(String securitycode,
UserVO data)
Performs the core logic for
UserManagementBase.confirmUser(String, UserVO) |
protected User |
handleCreateOrUpdateExternalUser(ExternalUserVO userVO)
Performs the core logic for
UserManagementBase.createOrUpdateExternalUser(ExternalUserVO) |
protected User |
handleCreateUser(UserVO userVo,
boolean emailConfirmation,
boolean managerActivation)
Performs the core logic for
UserManagementBase.createUser(UserVO, boolean, boolean) |
protected User |
handleFindUserByAlias(String alias)
Performs the core logic for
UserManagementBase.findUserByAlias(String) |
protected User |
handleFindUserByEmail(String email)
Performs the core logic for
UserManagementBase.findUserByEmail(String) |
protected User |
handleFindUserByEmailAlias(String username)
Performs the core logic for
#findKenmeiUserByEmailAlias(String) |
protected User |
handleFindUserByExternalUserId(String userId,
String systemId)
Performs the core logic for
UserManagementBase.findUserByExternalUserId(String, String) |
protected long |
handleGetActiveUserCount()
Performs the core logic for
UserManagementBase.getActiveUserCount() |
protected UserRole[] |
handleGetRolesOfUser(Long userId)
Performs the core logic for
UserManagementBase.getRolesOfUser(Long) |
protected User |
handleInviteUserToBlog(Long blogId,
UserVO userVo,
BlogRole role)
Performs the core logic for
#inviteUserToBlog(Long, User, UserVO, com.communote.server.model.blog.BlogRole) |
protected User |
handleInviteUserToClient(UserVO userVo)
Performs the core logic for
#inviteUserToClient(User, UserVO) |
protected void |
handlePermanentlyDisableUser(Long userId,
Long[] blogIds,
boolean becomeManager)
Performs the core logic for
UserManagementBase.permanentlyDisableUser(Long, Long[], boolean) |
protected User |
handleRegisterUser(String email,
Locale locale,
UserManagement.RegistrationType type)
Performs the core logic for
#registerUser(String, java.util.Locale) |
protected User |
handleRemoveUserRole(Long userId,
UserRole role)
Performs the core logic for
UserManagementBase.removeUserRole(Long, UserRole) |
protected void |
handleResetPermanentId(String systemId)
Performs the core logic for
#resetExternalUserId(String) |
protected User |
handleUnlockUser(String securityCode)
Performs the core logic for
UserManagementBase.unlockUser(String) |
protected User |
handleUpdateExternalUser(ExternalUserVO userVO)
Performs the core logic for
UserManagementBase.updateExternalUser(ExternalUserVO) |
protected void |
handleUpdateLanguage(Long userId,
String languageCode)
Performs the core logic for
UserManagementBase.updateLanguage(Long, String) |
boolean |
hasExternalAuthentication(long userId,
String externalSystemId) |
protected void |
init() |
void |
registerActivationValidator(UserActivationValidator validator)
Register a validator that will be called before the status of a user is set to
ACTIVE . |
void |
resetTermsOfUse()
Reset the terms of use for all users which have already accepted the terms of use.
|
void |
sendReminderMails() |
void |
unregisterActivationValidator(UserActivationValidator validator)
Unregister a previously registered validator.
|
void |
updateUserTags(Long userId,
Set<TagTO> tags)
Updates the tags of the given user.
|
acceptTermsOfUse, anonymizeUser, assignUserRole, changeEmailAddress, changeUserStatusByManager, confirmNewEmailAddress, confirmUser, createOrUpdateExternalUser, createUser, findUserByAlias, findUserByEmail, findUserByEmailAlias, findUserByExternalUserId, findUserByUserId, getActiveUserCount, getPrincipal, getRolesOfUser, inviteUserToBlog, inviteUserToClient, permanentlyDisableUser, registerUser, removeUserRole, resetPermanentId, unlockUser, updateExternalUser, updateLanguage
public boolean 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.@Transactional(readOnly=true) public Collection<User> findNotDeletedUsers(boolean excludeSystemUsers)
UserManagement
excludeSystemUsers
- whether to exclude the users who have the system user rolepublic User findUser(UserIdentification userIdentification)
UserManagement
ExternalUserAuthentication
suserIdentification
- the identificationpublic User findUser(UserIdentification userIdentification, boolean loadExternalAuthentications)
UserManagement
userIdentification
- the identificationloadExternalAuthentications
- true if the external auths of the user should be loaded as well@Transactional(readOnly=true) public User findUserByUserId(Long userId, boolean loadExternalAuthentications)
UserManagement
UserManagement.getUserById(Long, Converter)
instead.userId
- Id of the user to find.loadExternalAuthentications
- true to load the external authentications of the user@Transactional(readOnly=true) public List<User> findUsersByRole(UserRole role, UserStatus status)
UserManagement
@Transactional(readOnly=true) public String generateUniqueAlias(String externalUserName, String emailAddress)
UserManagement
externalUserName
- the external user name to try first. Can be null.emailAddress
- the email address to extract the alias from@Transactional(readOnly=true) public long getActiveUserCount(String systemId, UserRole role)
UserManagement
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.public Set<ExternalUserAuthentication> getExternalExternalUserAuthentications(long userId)
userId
- The users id.@Transactional(readOnly=true) public <T> T getUserById(Long userId, Converter<User,T> converter)
UserManagement
T
- the type of the resulting objectuserId
- the ID of the userconverter
- the converter to useprotected void handleAcceptTermsOfUse(Long userId) throws UserNotFoundException, AuthorizationException, UserActivationValidationException
handleAcceptTermsOfUse
in class UserManagementBase
UserNotFoundException
AuthorizationException
UserActivationValidationException
protected void handleAnonymizeUser(Long userId, Long[] blogIds, boolean becomeManager) throws AuthorizationException, NoBlogManagerLeftException, NoClientManagerLeftException, UserDeletionDisabledException
UserManagementBase
UserManagementBase.anonymizeUser(Long, Long[], boolean)
handleAnonymizeUser
in class UserManagementBase
AuthorizationException
NoBlogManagerLeftException
NoClientManagerLeftException
UserDeletionDisabledException
protected User handleAssignUserRole(Long userId, UserRole role) throws AuthorizationException, InvalidOperationException
UserManagementBase
UserManagementBase.assignUserRole(Long, UserRole)
handleAssignUserRole
in class UserManagementBase
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 boolean handleChangeEmailAddress(Long userId, String newEmail, boolean sendConfirmationEmail) throws EmailAlreadyExistsException, EmailValidationException
UserManagementBase
#changeEmailAddress(Long, String)
handleChangeEmailAddress
in class UserManagementBase
userId
- Id of the user, which email should be changed.newEmail
- The new email address.sendConfirmationEmail
- 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.EmailAlreadyExistsException
EmailValidationException
protected void handleChangeUserStatusByManager(Long userId, UserStatus newStatus) throws UserActivationValidationException, InvalidUserStatusTransitionException, UserNotFoundException, NoClientManagerLeftException
protected void handleConfirmNewEmailAddress(String securityCode) throws SecurityCodeNotFoundException, EmailAlreadyExistsException
UserManagementBase
UserManagementBase.confirmNewEmailAddress(String)
handleConfirmNewEmailAddress
in class UserManagementBase
SecurityCodeNotFoundException
EmailAlreadyExistsException
protected User handleConfirmUser(String securitycode, UserVO data) throws SecurityCodeNotFoundException, EmailValidationException, EmailAlreadyExistsException, AliasAlreadyExistsException, PasswordValidationException, InvalidUserStatusTransitionException, ExternalUserPasswordChangeNotAllowedException
UserManagementBase
UserManagementBase.confirmUser(String, UserVO)
protected User handleCreateOrUpdateExternalUser(ExternalUserVO userVO) throws EmailAlreadyExistsException, EmailValidationException, AliasAlreadyExistsException, UserActivationValidationException, InvalidUserStatusTransitionException, PermanentIdMissmatchException
UserManagementBase
UserManagementBase.createOrUpdateExternalUser(ExternalUserVO)
protected User handleCreateUser(UserVO userVo, boolean emailConfirmation, boolean managerActivation) throws EmailAlreadyExistsException, EmailValidationException, AliasAlreadyExistsException, PasswordValidationException
UserManagementBase
UserManagementBase.createUser(UserVO, boolean, boolean)
handleCreateUser
in class UserManagementBase
EmailAlreadyExistsException
EmailValidationException
AliasAlreadyExistsException
PasswordValidationException
protected User handleFindUserByAlias(String alias)
UserManagementBase
UserManagementBase.findUserByAlias(String)
handleFindUserByAlias
in class UserManagementBase
protected User handleFindUserByEmail(String email)
UserManagementBase
UserManagementBase.findUserByEmail(String)
handleFindUserByEmail
in class UserManagementBase
protected User handleFindUserByEmailAlias(String username)
UserManagementBase
#findKenmeiUserByEmailAlias(String)
handleFindUserByEmailAlias
in class UserManagementBase
protected User handleFindUserByExternalUserId(String userId, String systemId)
UserManagementBase
UserManagementBase.findUserByExternalUserId(String, String)
handleFindUserByExternalUserId
in class UserManagementBase
protected long handleGetActiveUserCount()
UserManagementBase
UserManagementBase.getActiveUserCount()
handleGetActiveUserCount
in class UserManagementBase
protected UserRole[] handleGetRolesOfUser(Long userId)
UserManagementBase
UserManagementBase.getRolesOfUser(Long)
handleGetRolesOfUser
in class UserManagementBase
protected User handleInviteUserToBlog(Long blogId, UserVO userVo, BlogRole role) throws AliasAlreadyExistsException, EmailAlreadyExistsException, EmailValidationException, PermanentIdMissmatchException, AuthorizationException
UserManagementBase
#inviteUserToBlog(Long, User, UserVO, com.communote.server.model.blog.BlogRole)
handleInviteUserToBlog
in class UserManagementBase
BlogAccessException
- in case the current user is not allowed to add the userAuthorizationException
- in case there is no current userAliasAlreadyExistsException
EmailAlreadyExistsException
EmailValidationException
PermanentIdMissmatchException
protected User handleInviteUserToClient(UserVO userVo) throws EmailValidationException, EmailAlreadyExistsException, AliasAlreadyExistsException, PermanentIdMissmatchException, AuthorizationException
UserManagementBase
#inviteUserToClient(User, UserVO)
protected void handlePermanentlyDisableUser(Long userId, Long[] blogIds, boolean becomeManager) throws AuthorizationException, NoBlogManagerLeftException, NoClientManagerLeftException, UserDeletionDisabledException, InvalidUserStatusTransitionException
UserManagementBase.permanentlyDisableUser(Long, Long[], boolean)
protected User handleRegisterUser(String email, Locale locale, UserManagement.RegistrationType type) throws EmailValidationException, EmailAlreadyExistsException
#registerUser(String, java.util.Locale)
handleRegisterUser
in class UserManagementBase
EmailValidationException
EmailAlreadyExistsException
UserManagement.registerUser(String, Locale, RegistrationType)
protected User handleRemoveUserRole(Long userId, UserRole role) throws AuthorizationException, InvalidOperationException, NoClientManagerLeftException
UserManagementBase
UserManagementBase.removeUserRole(Long, UserRole)
handleRemoveUserRole
in class UserManagementBase
AuthorizationException
- 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
roleprotected void handleResetPermanentId(String systemId) throws AuthorizationException
#resetExternalUserId(String)
handleResetPermanentId
in class UserManagementBase
AuthorizationException
protected User handleUnlockUser(String securityCode) throws SecurityCodeNotFoundException
UserManagementBase
UserManagementBase.unlockUser(String)
handleUnlockUser
in class UserManagementBase
SecurityCodeNotFoundException
protected User handleUpdateExternalUser(ExternalUserVO userVO) throws AliasAlreadyExistsException, EmailValidationException, EmailAlreadyExistsException, UserActivationValidationException, InvalidUserStatusTransitionException, PermanentIdMissmatchException
UserManagementBase
UserManagementBase.updateExternalUser(ExternalUserVO)
protected void handleUpdateLanguage(Long userId, String languageCode)
UserManagementBase
UserManagementBase.updateLanguage(Long, String)
handleUpdateLanguage
in class UserManagementBase
public boolean hasExternalAuthentication(long userId, String externalSystemId)
userId
- The users id.externalSystemId
- ID of an external system@PostConstruct protected void init()
public void registerActivationValidator(UserActivationValidator validator)
UserManagement
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 addpublic void resetTermsOfUse() throws AuthorizationException
UserManagement
AuthorizationException
- in case the current user is not client manager or internal system userpublic void sendReminderMails()
public void unregisterActivationValidator(UserActivationValidator validator)
UserManagement
validator
- the validator to removeCopyright © 2019 Communote team. All rights reserved.