Class HibernateUserDAO

    • Method Detail

      • ignoreCaseLogin

        public static boolean ignoreCaseLogin()
      • findByName

        public List<User> findByName​(String name)
        Description copied from interface: UserDAO
        This method finds an User by name.
        Specified by:
        findByName in interface UserDAO
        Parameters:
        name - The name of wanted User.
        Returns:
        Collection of selected users.
      • findByUsername

        public User findByUsername​(String username)
        Description copied from interface: UserDAO
        This method finds an User by its username. The search is case sensitive.
        Specified by:
        findByUsername in interface UserDAO
        Parameters:
        username - username of wanted User.
        Returns:
        Wanted User or null if user doesn't exist.
      • findByUsernameIgnoreCase

        public User findByUsernameIgnoreCase​(String username)
        Description copied from interface: UserDAO
        This method finds an User by its username. The search is case insensitive.
        Specified by:
        findByUsernameIgnoreCase in interface UserDAO
        Parameters:
        username - username of wanted User.
        Returns:
        Wanted User or null if user doesn't exist.
      • findByUsernameAndName

        public List<User> findByUsernameAndName​(String username,
                                                String name)
        Description copied from interface: UserDAO
        This method finds an User by username and name.
        Specified by:
        findByUsernameAndName in interface UserDAO
        Parameters:
        username - The username of wanted user
        name - The name of wanted user
        Returns:
        Collection of selected users
      • validateUser

        public boolean validateUser​(String username)
        Description copied from interface: UserDAO
        Validates an username only (the password content is not inspected).
        Specified by:
        validateUser in interface UserDAO
        Parameters:
        username - Username of the User to be validated.
        Returns:
        True if User is valid.
      • isPasswordExpired

        public boolean isPasswordExpired​(String username)
        Description copied from interface: UserDAO
        Is password expired.
        Specified by:
        isPasswordExpired in interface UserDAO
        Parameters:
        username - Username of the User to be validated.
        Returns:
        True if the password is expired
      • isInactive

        public boolean isInactive​(String username)
        Description copied from interface: UserDAO
        Checks if a user is inactive, that is a user without interactions in the last X days after it has last enabled. We look at the User.getMaxInactivity() first en then we fallback to the general parameter security.user.maxinactivity
        Specified by:
        isInactive in interface UserDAO
        Parameters:
        username - identifier of the user
        Returns:
        the last interaction time
      • count

        public int count​(Long tenantId)
        Description copied from interface: UserDAO
        Counts the total number of standard users
        Specified by:
        count in interface UserDAO
        Parameters:
        tenantId - identifier of the tenant
        Returns:
        total number of guest users
      • countGuests

        public int countGuests​(Long tenantId)
        Description copied from interface: UserDAO
        Counts the total number of guest users
        Specified by:
        countGuests in interface UserDAO
        Parameters:
        tenantId - identifier of the tenant
        Returns:
        total number of guest users
      • delete

        public boolean delete​(long userId,
                              int code)
        Description copied from interface: PersistentObjectDAO
        This method deletes an entity and you can give a deletion code
        Specified by:
        delete in interface PersistentObjectDAO<User>
        Overrides:
        delete in class HibernatePersistentObjectDAO<User>
        Parameters:
        userId - ID of the entity which should be deleted
        code - Deletion code
        Returns:
        if the record has been successfully deleted
      • delete

        public boolean delete​(long userId,
                              UserHistory transaction)
        Description copied from interface: UserDAO
        This method deletes the user object and insert a new user history entry.
        Specified by:
        delete in interface UserDAO
        Parameters:
        userId - The id of the user to delete
        transaction - entry to log the event
        Returns:
        True if successfully deleted from the database.
      • setUserHistoryDAO

        public void setUserHistoryDAO​(UserHistoryDAO userHistoryDAO)
      • setUserListenerManager

        public void setUserListenerManager​(UserListenerManager userListenerManager)
      • findUserSettings

        public Map<String,​Generic> findUserSettings​(long userId,
                                                          String namePrefix)
        Description copied from interface: UserDAO
        Retrieves the settings for a user. The settings are stored as Generics of type usersetting.
        Specified by:
        findUserSettings in interface UserDAO
        Parameters:
        userId - Identifier of the user
        namePrefix - Name prefix of the property (optional)
        Returns:
        The map setting_name-generic
      • setGenericDAO

        public void setGenericDAO​(GenericDAO genericDAO)
      • findAdminUser

        public User findAdminUser​(String tenantName)
        Description copied from interface: UserDAO
        Retrieve the administrator for the given tenant. The general rule is that the administrator's username is:
        1. admin if the tenant is default
        2. adminTenantname in all other cases
        Specified by:
        findAdminUser in interface UserDAO
        Parameters:
        tenantName - name of the tenant
        Returns:
        the user to administrate the tenant
      • findByGroup

        public Set<User> findByGroup​(long groupId)
        Description copied from interface: UserDAO
        Retrieves the users belonging to a given group.
        Specified by:
        findByGroup in interface UserDAO
        Parameters:
        groupId - Identifier of the group
        Returns:
        the set of groups
      • getUser

        public User getUser​(String username)
        Description copied from interface: UserDAO
        Depending on the global setting, it invokes findByUsername or findByUsernameIgnoreCase
        Specified by:
        getUser in interface UserDAO
        Parameters:
        username - The username of the user
        Returns:
        The found user
      • setPasswordHistoryDAO

        public void setPasswordHistoryDAO​(PasswordHistoryDAO passwordHistoryDAO)