Class UserService<E extends User,​D extends UserDao<E>>

    • Constructor Detail

      • UserService

        public UserService()
        Default constructor, which calls the type-constructor
      • UserService

        protected UserService​(Class<E> entityClass)
        Constructor that sets the concrete entity class for the service. Subclasses MUST call this constructor.
    • Method Detail

      • setDao

        @Autowired
        @Qualifier("userDao")
        public void setDao​(D dao)
        We have to use Qualifier to define the correct dao here. Otherwise, spring can not decide which dao has to be autowired here as there are multiple candidates.
        Overrides:
        setDao in class PersonService<E extends User,​D extends UserDao<E>>
        Parameters:
        dao - the dao to set
      • findByAccountName

        @PostAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#accountName, \'READ\')")
        @Transactional(readOnly=true)
        public E findByAccountName​(String accountName)
        Returns the user for the given (unique) account name. If no user was found, null will be returned.
        Parameters:
        accountName - A unique account name.
        Returns:
        The unique user for the account name or null.
      • findByEmail

        @PostAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#email, \'READ\')")
        @Transactional(readOnly=true)
        public E findByEmail​(String email)
        Parameters:
        email -
        Returns:
      • registerUser

        public E registerUser​(E user,
                              javax.servlet.http.HttpServletRequest request)
                       throws Exception
        Registers a new user. Initially, the user will be inactive. An email with an activation link will be sent to the user.
        Parameters:
        user - A user with an UNencrypted password (!)
        request -
        Throws:
        Exception
      • persistNewUser

        public E persistNewUser​(E user,
                                boolean encryptPassword)
        Persists a new user in the database.
        Parameters:
        user - The user to create
        encryptPassword - Whether or not the current password of the user object should be encrypted or not before the object is persisted in the db
        Returns:
        The persisted user object (incl. ID value)
      • updatePassword

        public void updatePassword​(E user,
                                   String rawPassword)
                            throws Exception
        Parameters:
        user -
        rawPassword -
        Throws:
        Exception
      • getUserBySession

        @Transactional(readOnly=true)
        public E getUserBySession()
      • getGroupsOfUser

        @PostFilter("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(filterObject, \'READ\')")
        @Transactional(readOnly=true)
        public Set<UserGroup> getGroupsOfUser​(Integer userId)
                                       throws Exception
        Parameters:
        userId -
        Throws:
        Exception
      • getPasswordEncoder

        public org.springframework.security.crypto.password.PasswordEncoder getPasswordEncoder()
        Returns:
        the passwordEncoder
      • setPasswordEncoder

        public void setPasswordEncoder​(org.springframework.security.crypto.password.PasswordEncoder passwordEncoder)
        Parameters:
        passwordEncoder - the passwordEncoder to set
      • getDefaultUserRole

        public Role getDefaultUserRole()
        Returns:
        the defaultUserRole
      • setDefaultUserRole

        public void setDefaultUserRole​(Role defaultUserRole)
        Parameters:
        defaultUserRole - the defaultUserRole to set