Interface BasicUserServiceLocal

    • 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
      • 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 user
        generatedPasswordTypes - 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 the Permission.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
      • 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 of UserPrincipalData for all PrincipalType where the corresponding ProfileField is enabled for the user.
        Each element of the list contains:
        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.
      • 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.
      • 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 an BasicUserRegistrationDTO then 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 the UserRegistration
        Returns:
        a Map with 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 calls UserSearchHandler#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