Package com.logicaldoc.core.security.dao
Interface UserDAO
-
- All Superinterfaces:
PersistentObjectDAO<User>
- All Known Implementing Classes:
HibernateUserDAO
public interface UserDAO extends PersistentObjectDAO<User>
This class is a DAO-service for User-objects.- Version:
- 1.0
- Author:
- Michael Scholz, Marco Meschieri
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
count(Long tenantId)
Counts the total number of standard usersint
countGuests(Long tenantId)
Counts the total number of guest usersboolean
delete(long userId, UserHistory transaction)
This method deletes the user object and insert a new user history entry.User
findAdminUser(String tenantName)
Retrieve the administrator for the given tenant.Set<User>
findByGroup(long groupId)
Retrieves the users belonging to a given group.List<User>
findByLikeUsername(String username)
This method finds an User by username.List<User>
findByName(String name)
This method finds an User by name.User
findByUsername(String username)
This method finds an User by its username.List<User>
findByUsernameAndName(String username, String name)
This method finds an User by username and name.User
findByUsernameIgnoreCase(String username)
This method finds an User by its username.Map<String,Generic>
findUserSettings(long userId, String namePrefix)
Retrieves the settings for a user.User
getUser(String username)
Depending on the global setting, it invokes findByUsername or findByUsernameIgnoreCaseboolean
isPasswordExpired(String username)
Is password expired.boolean
store(User user, UserHistory transaction)
This method persists the user object and insert a new user history entry.boolean
validateUser(String username)
Validates an username only (the password content is not inspectged.boolean
validateUser(String username, String password)
Validates an username and a password-
Methods inherited from interface com.logicaldoc.core.PersistentObjectDAO
bulkUpdate, delete, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, initialize, isOracle, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForObject, queryForRowSet, queryForString, store
-
-
-
-
Method Detail
-
count
int count(Long tenantId)
Counts the total number of standard users- Parameters:
tenantId
- identifier of the tenant- Returns:
- total number of guest users
-
countGuests
int countGuests(Long tenantId)
Counts the total number of guest users- Parameters:
tenantId
- identifier of the tenant- Returns:
- total number of guest users
-
findByUsername
User findByUsername(String username)
This method finds an User by its username. The search is case sensitive.- Parameters:
username
- username of wanted User.- Returns:
- Wanted User or null if user doesn't exist.
-
findByUsernameIgnoreCase
User findByUsernameIgnoreCase(String username)
This method finds an User by its username. The search is case insensitive.- Parameters:
username
- username of wanted User.- Returns:
- Wanted User or null if user doesn't exist.
-
getUser
User getUser(String username)
Depending on the global setting, it invokes findByUsername or findByUsernameIgnoreCase- Parameters:
username
- The username of the user- Returns:
- The found user
-
findByLikeUsername
List<User> findByLikeUsername(String username)
This method finds an User by username.- Parameters:
username
- The username of wanted User.- Returns:
- Collection of selected users.
-
findByName
List<User> findByName(String name)
This method finds an User by name.- Parameters:
name
- The name of wanted User.- Returns:
- Collection of selected users.
-
findByUsernameAndName
List<User> findByUsernameAndName(String username, String name)
This method finds an User by username and name.- Parameters:
username
- The username of wanted username
- The name of wanted user- Returns:
- Collection of selected users
-
validateUser
boolean validateUser(String username, String password)
Validates an username and a password- Parameters:
username
- Username of the User to be validatedpassword
- Password of the User to be validated- Returns:
- True if User is valid and authenticated.
-
validateUser
boolean validateUser(String username)
Validates an username only (the password content is not inspectged.- Parameters:
username
- Username of the User to be validated.- Returns:
- True if User is valid.
-
isPasswordExpired
boolean isPasswordExpired(String username)
Is password expired.- Parameters:
username
- Username of the User to be validate.- Returns:
- True if the password is expired
-
delete
boolean delete(long userId, UserHistory transaction)
This method deletes the user object and insert a new user history entry.- Parameters:
userId
- The id of the user to deletetransaction
- entry to log the event- Returns:
- True if successfully deleted from the database.
-
store
boolean store(User user, UserHistory transaction)
This method persists the user object and insert a new user history entry.- Parameters:
user
- the user to storetransaction
- entry to log the event- Returns:
- True if successfully stored in a database.
-
findUserSettings
Map<String,Generic> findUserSettings(long userId, String namePrefix)
Retrieves the settings for a user. The settings are stored as Generics of type usersetting.- Parameters:
userId
- Identifier of the usernamePrefix
- Name prefix of the property (optional)- Returns:
- The map setting_name-generic
-
findAdminUser
User findAdminUser(String tenantName)
Retrieve the administrator for the given tenant. The general rule is that the administrator's username is:- admin if the tenant is default
- adminTenantname in all other cases
- Parameters:
tenantName
- name of the tenant- Returns:
- the user to administrate the tenant
-
-