Class AdminUserDAO
java.lang.Object
fr.paris.lutece.portal.business.user.AdminUserDAO
- All Implemented Interfaces:
IAdminUserDAO
This class porvides Data Access methods for AdminUser objects
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcheckAccessCodeAlreadyInUse(String strAccessCode) Checks the availibility of an access codeintcheckEmailAlreadyInUse(String strEmail) Checks the availibility of an emailbooleancheckRoleAttributed(String strRoleKey) Checks wether the role is in use or notintcountUserPasswordHistoryFromDate(Timestamp minDate, int nUserId) Get the number of password change done by a user since the given date.voiddelete(int nUserId) Delete an uservoiddeleteAllDelegatedRightsForUser(int nUserId, int nUserLevel) Deletes rights delegated by user ie rights with level < userlevelvoiddeleteAllOwnRightsForUser(int nUserId, int nUserLevel) Deletes all rights owned by user ie rights with level >= userlevelvoiddeleteAllRightsForUser(int nUserId) Delete all rights owned by an uservoiddeleteAllRolesForUser(int nUserId) Remove all rights from an uservoiddeleteRightForUser(int nUserId, String strIdRight) Remove a right for an uservoiddeleteRoleForUser(int nUserId, String strRoleKey) Remove role for an userGet the list of id of user with the expired status.getIdUsersToSendFirstAlert(Timestamp alertMaxDate) Get the list of id of users that need to receive their first alertgetIdUsersToSendOtherAlert(Timestamp alertMaxDate, Timestamp timeBetweenAlerts, int maxNumberAlerts) Get the list of id of users that need to receive their first alertgetIdUsersWithExpiredLifeTimeList(Timestamp currentTimestamp) Get the list of id of users that have an expired time life but not the expired statusgetIdUsersWithExpiredPasswordsList(Timestamp currentTimestamp) Get the list of id of users that have an expired password but not the change password flaggetUsersWithLifeTimeToResync(Timestamp maxValidDate) Get the users whose account life time may have to be resynchronized from their last login date : users with a not null account max valid date lower than the given date, and whose status is active, not active or expired (anonymized users are ignored).booleanCheck if the user has the given rightbooleanCheck if the user has the rolevoidInsert a new record in the table.voidinsert(LuteceDefaultAdminUser user) Insert a new record in the table.voidinsertNewPasswordInHistory(IPassword password, int nUserId) Log a password change in the password historyvoidinsertRightsListForUser(int nUserId, String strRightId) Add a right to an uservoidinsertRolesListForUser(int nUserId, String strRoleKey) Gives a role to an userload(int nUserId) Load an AdminUserloadDefaultAdminUser(int nUserId) Load a default AdminUservoidremoveAllPasswordHistoryForUser(int nUserId) Remove every password saved in the password history for a given user.Get a map of anonymization status of a user field.selectRightsListForUser(int nUserId) Get the right list associated to a given user idselectRolesListForUser(int nUserId) Get the role list associated to a given user idselectUserByAccessCode(String strUserAccessCode) Get an user by its access code (login)<T extends AdminUser>
TselectUserByAccessCode(String strUserAccessCode, T user) Get an user by its access code (login)selectUserByEmail(String strEmail) Get the user access code from its email.Gets the collection of all AdminUsersselectUserPasswordHistory(int nUserID) Gets the history of password of the given userselectUsersByFilter(AdminUserFilter auFilter) Select users by filterselectUsersByLevel(int nIdLevel) Select all user that own a given levelselectUsersByRight(String strIdRight) Get all users having a given rightselectUsersByRole(String strRoleKey) Gets a collection of AdminUser that share a given rolevoidUpdate AdminUser datavoidstore(LuteceDefaultAdminUser user, PasswordUpdateMode passwordMode) Update AdminUser datavoidstoreUsersRole(String strOldRoleKey, RBACRole role) Update role key if role key name has changevoidupdateAnonymizationStatusUserStaticField(String strFieldName, boolean bAnonymizeFiled) Update the anonymization status of a user field.voidupdateChangePassword(List<Integer> listIdUser) Set the "change password" flag of users to truevoidupdateDateLastLogin(int nIdUser, Timestamp dateLastLogin) Update the admin user last login date.voidupdateNbAlert(List<Integer> listIdUser) Increment the number of alert send to users by 1voidupdateUserExpirationDate(int nIdUser, Timestamp newExpirationDate) Update the admin user expiration date with the new values.voidupdateUserStatus(List<Integer> listIdUser, int nNewStatus) Update status of a list of user accounts
-
Constructor Details
-
AdminUserDAO
public AdminUserDAO()
-
-
Method Details
-
load
Load an AdminUser- Specified by:
loadin interfaceIAdminUserDAO- Parameters:
nUserId- the user id- Returns:
- user
-
selectUserByAccessCode
Get an user by its access code (login)- Specified by:
selectUserByAccessCodein interfaceIAdminUserDAO- Parameters:
strUserAccessCode- the login- Returns:
- The user found, otherwise null
-
selectUserByAccessCode
Get an user by its access code (login)- Specified by:
selectUserByAccessCodein interfaceIAdminUserDAO- Parameters:
strUserAccessCode- the loginuser- the user to load- Returns:
- The user found, otherwise null
-
selectUserByEmail
Get the user access code from its email.- Specified by:
selectUserByEmailin interfaceIAdminUserDAO- Parameters:
strEmail- The email- Returns:
- The access code of the user with the given email, or null if no user has been found
-
selectUserList
Gets the collection of all AdminUsers- Specified by:
selectUserListin interfaceIAdminUserDAO- Returns:
- The user list
-
insert
Insert a new record in the table.- Specified by:
insertin interfaceIAdminUserDAO- Parameters:
user- The AdminUser
-
store
Update AdminUser data- Specified by:
storein interfaceIAdminUserDAO- Parameters:
user- The AdminUser
-
delete
public void delete(int nUserId) Delete an user- Specified by:
deletein interfaceIAdminUserDAO- Parameters:
nUserId- the user id
-
selectRightsListForUser
Get the right list associated to a given user id- Specified by:
selectRightsListForUserin interfaceIAdminUserDAO- Parameters:
nUserId- the id of the user to retrieve rights- Returns:
- the right list as a collection of strings
-
insertRightsListForUser
Add a right to an user- Specified by:
insertRightsListForUserin interfaceIAdminUserDAO- Parameters:
nUserId- the user idstrRightId- the right id
-
deleteAllRightsForUser
public void deleteAllRightsForUser(int nUserId) Delete all rights owned by an user- Specified by:
deleteAllRightsForUserin interfaceIAdminUserDAO- Parameters:
nUserId- the user id
-
selectRolesListForUser
Get the role list associated to a given user id- Specified by:
selectRolesListForUserin interfaceIAdminUserDAO- Parameters:
nUserId- the id of the user to retrieve roles- Returns:
- the role list
-
insertRolesListForUser
Gives a role to an user- Specified by:
insertRolesListForUserin interfaceIAdminUserDAO- Parameters:
nUserId- the user idstrRoleKey- the key role
-
deleteAllRolesForUser
public void deleteAllRolesForUser(int nUserId) Remove all rights from an user- Specified by:
deleteAllRolesForUserin interfaceIAdminUserDAO- Parameters:
nUserId- the user id
-
checkRoleAttributed
Checks wether the role is in use or not- Specified by:
checkRoleAttributedin interfaceIAdminUserDAO- Parameters:
strRoleKey- the role key to check- Returns:
- user ID if the emaile is already used by another user, -1 otherwise
-
checkAccessCodeAlreadyInUse
Checks the availibility of an access code- Specified by:
checkAccessCodeAlreadyInUsein interfaceIAdminUserDAO- Parameters:
strAccessCode- The access code- Returns:
- user ID if the access code is already used by another user, -1 otherwise
-
checkEmailAlreadyInUse
Checks the availibility of an email- Specified by:
checkEmailAlreadyInUsein interfaceIAdminUserDAO- Parameters:
strEmail- The email- Returns:
- True if the email is already used by another user
-
insert
Insert a new record in the table.- Specified by:
insertin interfaceIAdminUserDAO- Parameters:
user- The AdminUser
-
store
Update AdminUser data- Specified by:
storein interfaceIAdminUserDAO- Parameters:
user- The AdminUserpasswordMode- Should the password be updated or not
-
loadDefaultAdminUser
Load a default AdminUser- Specified by:
loadDefaultAdminUserin interfaceIAdminUserDAO- Parameters:
nUserId- the user id- Returns:
- user
-
selectUsersByRole
Gets a collection of AdminUser that share a given role- Specified by:
selectUsersByRolein interfaceIAdminUserDAO- Parameters:
strRoleKey- The role key- Returns:
- The user List
-
selectUsersByLevel
Select all user that own a given level- Specified by:
selectUsersByLevelin interfaceIAdminUserDAO- Parameters:
nIdLevel- The level- Returns:
- userList The user's list
-
deleteAllOwnRightsForUser
public void deleteAllOwnRightsForUser(int nUserId, int nUserLevel) Deletes all rights owned by user ie rights with level >= userlevel- Specified by:
deleteAllOwnRightsForUserin interfaceIAdminUserDAO- Parameters:
nUserId- the user idnUserLevel- the user level
-
deleteAllDelegatedRightsForUser
public void deleteAllDelegatedRightsForUser(int nUserId, int nUserLevel) Deletes rights delegated by user ie rights with level < userlevel- Specified by:
deleteAllDelegatedRightsForUserin interfaceIAdminUserDAO- Parameters:
nUserId- the user idnUserLevel- the user level
-
storeUsersRole
Update role key if role key name has change- Specified by:
storeUsersRolein interfaceIAdminUserDAO- Parameters:
strOldRoleKey- The old role key namerole- The new role
-
hasRole
Check if the user has the role- Specified by:
hasRolein interfaceIAdminUserDAO- Parameters:
nUserId- The ID of the userstrRoleKey- The role Key- Returns:
- true if the user has the role
-
deleteRoleForUser
Remove role for an user- Specified by:
deleteRoleForUserin interfaceIAdminUserDAO- Parameters:
nUserId- The ID of the userstrRoleKey- The role key
-
selectUsersByFilter
Select users by filter- Specified by:
selectUsersByFilterin interfaceIAdminUserDAO- Parameters:
auFilter- the filter- Returns:
- a list of AdminUser
-
selectUsersByRight
Get all users having a given right- Specified by:
selectUsersByRightin interfaceIAdminUserDAO- Parameters:
strIdRight- The ID right- Returns:
- A collection of AdminUser
-
hasRight
Check if the user has the given right- Specified by:
hasRightin interfaceIAdminUserDAO- Parameters:
nUserId- The ID of the userstrIdRight- The ID right- Returns:
- true if the user has the right
-
deleteRightForUser
Remove a right for an user- Specified by:
deleteRightForUserin interfaceIAdminUserDAO- Parameters:
nUserId- The user IDstrIdRight- The right ID
-
selectUserPasswordHistory
Gets the history of password of the given user- Specified by:
selectUserPasswordHistoryin interfaceIAdminUserDAO- Parameters:
nUserID- Id of the user- Returns:
- The collection of recent passwords used by the user.
-
countUserPasswordHistoryFromDate
Get the number of password change done by a user since the given date.- Specified by:
countUserPasswordHistoryFromDatein interfaceIAdminUserDAO- Parameters:
minDate- Minimum date to consider.nUserId- Id of the user- Returns:
- The number of password change done by the user since the given date.
-
insertNewPasswordInHistory
Log a password change in the password history- Specified by:
insertNewPasswordInHistoryin interfaceIAdminUserDAO- Parameters:
password- New password of the usernUserId- Id of the user
-
removeAllPasswordHistoryForUser
public void removeAllPasswordHistoryForUser(int nUserId) Remove every password saved in the password history for a given user.- Specified by:
removeAllPasswordHistoryForUserin interfaceIAdminUserDAO- Parameters:
nUserId- Id of the user
-
selectAnonymizationStatusUserStaticField
Get a map of anonymization status of a user field.- Specified by:
selectAnonymizationStatusUserStaticFieldin interfaceIAdminUserDAO- Returns:
- A map containing the associations of user field name and a boolean describing whether the field should be anonymized.
-
updateAnonymizationStatusUserStaticField
Update the anonymization status of a user field.- Specified by:
updateAnonymizationStatusUserStaticFieldin interfaceIAdminUserDAO- Parameters:
strFieldName- Name of the field to updatebAnonymizeFiled- True if the field should be anonymized, false otherwise
-
findAllExpiredUserId
Get the list of id of user with the expired status.- Specified by:
findAllExpiredUserIdin interfaceIAdminUserDAO- Returns:
- The list of if of user with the expired status.
-
getIdUsersWithExpiredLifeTimeList
Get the list of id of users that have an expired time life but not the expired status- Specified by:
getIdUsersWithExpiredLifeTimeListin interfaceIAdminUserDAO- Parameters:
currentTimestamp- Timestamp describing the current time.- Returns:
- the list of id of users with expired time life
-
getUsersWithLifeTimeToResync
Get the users whose account life time may have to be resynchronized from their last login date : users with a not null account max valid date lower than the given date, and whose status is active, not active or expired (anonymized users are ignored). Only the id, the status, the account max valid date and the last login date of the returned users are set.- Specified by:
getUsersWithLifeTimeToResyncin interfaceIAdminUserDAO- Parameters:
maxValidDate- The maximum account valid date of the users to return- Returns:
- the list of users, with only their id, status, account max valid date and last login date set
-
getIdUsersToSendFirstAlert
Get the list of id of users that need to receive their first alert- Specified by:
getIdUsersToSendFirstAlertin interfaceIAdminUserDAO- Parameters:
alertMaxDate- The maximum date to send alerts.- Returns:
- the list of id of users that need to receive their first alert
-
getIdUsersToSendOtherAlert
public List<Integer> getIdUsersToSendOtherAlert(Timestamp alertMaxDate, Timestamp timeBetweenAlerts, int maxNumberAlerts) Get the list of id of users that need to receive their first alert- Specified by:
getIdUsersToSendOtherAlertin interfaceIAdminUserDAO- Parameters:
alertMaxDate- The maximum date to send alerts.timeBetweenAlerts- Timestamp describing the time between two alerts.maxNumberAlerts- Maximum number of alerts to send to a user- Returns:
- the list of id of users that need to receive their first alert
-
getIdUsersWithExpiredPasswordsList
Get the list of id of users that have an expired password but not the change password flag- Specified by:
getIdUsersWithExpiredPasswordsListin interfaceIAdminUserDAO- Parameters:
currentTimestamp- Timestamp describing the current time.- Returns:
- the list of id of users with expired passwords
-
updateUserStatus
Update status of a list of user accounts- Specified by:
updateUserStatusin interfaceIAdminUserDAO- Parameters:
listIdUser- List of user accounts to updatenNewStatus- New status of the user
-
updateNbAlert
Increment the number of alert send to users by 1- Specified by:
updateNbAlertin interfaceIAdminUserDAO- Parameters:
listIdUser- The list of users to update
-
updateChangePassword
Set the "change password" flag of users to true- Specified by:
updateChangePasswordin interfaceIAdminUserDAO- Parameters:
listIdUser- The list of users to update
-
updateUserExpirationDate
Update the admin user expiration date with the new values. Also update his alert account to 0- Specified by:
updateUserExpirationDatein interfaceIAdminUserDAO- Parameters:
nIdUser- Id of the admin user to updatenewExpirationDate- New expiration date of the user
-
updateDateLastLogin
Update the admin user last login date.- Specified by:
updateDateLastLoginin interfaceIAdminUserDAO- Parameters:
nIdUser- Id of the admin user to updatedateLastLogin- New last login date of the user
-