Package org.cyclos.impl.users
Interface BasicUserServiceLocal
-
- All Superinterfaces:
BasicUserService,Service
public interface BasicUserServiceLocal extends BasicUserService
Local interface forBasicUserService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddNameValidations(Property property, BasicUserDTO dto)As the CRUD service forces a custom handling of the name property, this needs to be in a separate methodvoidaddRegistrationValidations(Validator validator, SimpleBasicUserRegistrationDTO dto, UserRegistration registration, BasicUser basicUser, UserValidationFields fields)Add common validations for registering a user or operatorvoidaddValidations(Validator validator, BasicUserDTO dto, BasicUser user, UserValidationFields fields)Add common validations for saving the profile of a user or operator.UserRegistrationResultbuildRegistrationResult(BasicUser user, Set<PasswordType> generatedPasswordTypes)Builds the registration result for the given user.booleancanViewProfile(BasicUser user)Returns true if the logged user can view the profile of the given user.
NOTE: Take into account that a user can be related to a user but not see its profile, e.g a user can relates to an operator of another user (through thePermission.USER_OPERATORS_PAY) but he can't view the operator profile.voidclearValidationKey(BasicUser user)Removes all user data related to a validation keyList<ProfileField>fillProfileFields(BasicUser user, AbstractViewProfileData data)Fills in the visible profile fields of the given user on the given view profile datavoidfillRegistrationData(SimpleBasicUserRegistrationData data, UserRegistration registration, BasicUser user)Fills with common data for registering users or operatorsMap<PasswordType,String>finishActivation(BasicUser user)Generate the passwords and send the activation e-mail for the given userList<UserPrincipalData>getPrincipalsData(BasicUser basicUser, Channel channel)Returns a list ofUserPrincipalDatafor allPrincipalTypewhere the correspondingProfileFieldis enabled for the user.
Each element of the list contains:
ThePrincipalType. The principal asStringA list ofChannelVOwhere the principal type can be used to access the channel.BasicUsergetUserForValidationKey(ValidationKeyType type, String validationKey)Returns the user in the current network with the given validation keybooleanisEmailTaken(ConfigurationAccessor configuration, String email)Returns whether there's a non-removed user with this e-mail.booleanisMobileNumberTaken(ConfigurationAccessor configuration, String number)Returns whether there's a non-removed user with this mobile phone number.booleanisNameRequired(BasicUserDTO dto)Returns whether we should require the full name when saving the given userbooleanisUsernameTaken(ConfigurationAccessor configuration, String username)Returns whether there's a non-removed user with this username.voidpersistAdditionalRegistrationData(BasicUser user, SimpleBasicUserRegistrationDTO registrationDto, List<ProfileField> editableFields)Persists additional data that is saved together with the user, such as phones or addresses<BU extends BasicUser>
BUpreProcessRegistration(SimpleBasicUserRegistrationDTO dto, UserRegistration registration)Returns a pre-populated user for persistingMap<PasswordType,String>processRegistration(BasicUser user, SimpleBasicUserRegistrationDTO registrationDto)Processes a user registration.voidreindex(BasicUser user)Reindex calculated data in the database for the given user.booleanrequiresEmailChangeValidation(BasicUser user)Returns true if the system requires the user to validate the email upon email modificationvoidsetEmailChangeValidation(BasicUser user, String originalEmail)Sets the user validation key for e-mail change confirmation, restores the original e-mail (saving the current e-mail in new email) and sends the e-mailbooleanshouldCheckConfirmationPassword(BasicUser entity, CRUDOperation operation)Controls whether confirmation password should be checked for the given basic user and operation.DBQuery<?>uniqueEmailQuery(Network network, BasicUserDTO dto)Returns a query to validate the uniqueness of an e-mail addressvoidupdateDisplay(BasicUser user)Updates display fields in the given user according to his/hers current configuration-
Methods inherited from interface org.cyclos.services.users.BasicUserService
autocomplete, getAccessLogSearchData, loadAccessLog, manuallyValidateEmailChange, manuallyValidateRegistration, resendEmailChangeMail, resendRegistrationValidationMail, searchAccessLogs, updateUserActivity, validateEmailChange, validateRegistration
-
-
-
-
Method Detail
-
addNameValidations
void addNameValidations(Property property, BasicUserDTO dto)
As the CRUD service forces a custom handling of the name property, this needs to be in a separate method
-
addRegistrationValidations
void addRegistrationValidations(Validator validator, SimpleBasicUserRegistrationDTO dto, UserRegistration registration, BasicUser basicUser, UserValidationFields fields)
Add common validations for registering a user or operator
-
addValidations
void addValidations(Validator validator, BasicUserDTO dto, BasicUser user, UserValidationFields fields)
Add common validations for saving the profile of a user or operator. PRE: in case of a new user registration the user parameter MUST have set the registration type.
-
buildRegistrationResult
UserRegistrationResult buildRegistrationResult(BasicUser user, Set<PasswordType> generatedPasswordTypes)
Builds the registration result for the given user.- Parameters:
user- the already registered usergeneratedPasswordTypes- set of password types for which the passwords were generated.
-
canViewProfile
boolean canViewProfile(BasicUser user)
Returns true if the logged user can view the profile of the given user.
NOTE: Take into account that a user can be related to a user but not see its profile, e.g a user can relates to an operator of another user (through thePermission.USER_OPERATORS_PAY) but he can't view the operator profile.
-
clearValidationKey
void clearValidationKey(BasicUser user)
Removes all user data related to a validation key
-
fillProfileFields
List<ProfileField> fillProfileFields(BasicUser user, AbstractViewProfileData data)
Fills in the visible profile fields of the given user on the given view profile data
-
fillRegistrationData
void fillRegistrationData(SimpleBasicUserRegistrationData data, UserRegistration registration, BasicUser user)
Fills with common data for registering users or operators
-
finishActivation
Map<PasswordType,String> finishActivation(BasicUser user)
Generate the passwords and send the activation e-mail for the given user
-
getPrincipalsData
List<UserPrincipalData> getPrincipalsData(BasicUser basicUser, Channel channel)
Returns a list ofUserPrincipalDatafor allPrincipalTypewhere the correspondingProfileFieldis enabled for the user.
Each element of the list contains:
- The
PrincipalType. - The principal as
String - A list of
ChannelVOwhere the principal type can be used to access the channel.
- Parameters:
channel- create the list for all principal types used to access the channel (if accessible). If null then uses all accessible channels for the given user to get the principals types.
- The
-
getUserForValidationKey
BasicUser getUserForValidationKey(ValidationKeyType type, String validationKey)
Returns the user in the current network with the given validation key
-
isEmailTaken
boolean isEmailTaken(ConfigurationAccessor configuration, String email)
Returns whether there's a non-removed user with this e-mail. Returns false if e-mail is not marked as unique.
-
isMobileNumberTaken
boolean isMobileNumberTaken(ConfigurationAccessor configuration, String number)
Returns whether there's a non-removed user with this mobile phone number. Returns false if mobile phone is not marked as unique.
-
isNameRequired
boolean isNameRequired(BasicUserDTO dto)
Returns whether we should require the full name when saving the given user
-
isUsernameTaken
boolean isUsernameTaken(ConfigurationAccessor configuration, String username)
Returns whether there's a non-removed user with this username. Returns false if username is generated.
-
persistAdditionalRegistrationData
void persistAdditionalRegistrationData(BasicUser user, SimpleBasicUserRegistrationDTO registrationDto, List<ProfileField> editableFields)
Persists additional data that is saved together with the user, such as phones or addresses
-
preProcessRegistration
<BU extends BasicUser> BU preProcessRegistration(SimpleBasicUserRegistrationDTO dto, UserRegistration registration)
Returns a pre-populated user for persisting
-
processRegistration
Map<PasswordType,String> processRegistration(BasicUser user, SimpleBasicUserRegistrationDTO registrationDto)
Processes a user registration. If the user must validate the e-mail then sets the user validation key for user registration confirmation and sends the e-mail. Otherwise, if the dto is anBasicUserRegistrationDTOthen generates the passwords marked at registration and sends the activation or pending e-mail according to the user's status.- Parameters:
user- the user to be registered, it must have set theUserRegistration- Returns:
- a
Mapwith the generated passwords only if the user doesn't need to validate the e-mail. Otherwise returns an empty map.
-
reindex
void reindex(BasicUser user) throws FrameworkException
Reindex calculated data in the database for the given user. Examples: User display, redundant fields, purges custom fields no longer enabled... Also callsUserSearchHandler#index(org.cyclos.entities.users.User)for users- Throws:
FrameworkException
-
requiresEmailChangeValidation
boolean requiresEmailChangeValidation(BasicUser user)
Returns true if the system requires the user to validate the email upon email modification
-
setEmailChangeValidation
void setEmailChangeValidation(BasicUser user, String originalEmail)
Sets the user validation key for e-mail change confirmation, restores the original e-mail (saving the current e-mail in new email) and sends the e-mail
-
shouldCheckConfirmationPassword
boolean shouldCheckConfirmationPassword(BasicUser entity, CRUDOperation operation)
Controls whether confirmation password should be checked for the given basic user and operation.
-
uniqueEmailQuery
DBQuery<?> uniqueEmailQuery(Network network, BasicUserDTO dto)
Returns a query to validate the uniqueness of an e-mail address
-
updateDisplay
void updateDisplay(BasicUser user)
Updates display fields in the given user according to his/hers current configuration
-
-