Class AdminUserHome
java.lang.Object
fr.paris.lutece.portal.business.user.AdminUserHome
This class provides instances management methods (create, find, ...) for AdminUser objects
-
Method Summary
Modifier and TypeMethodDescriptionstatic intcheckAccessCodeAlreadyInUse(String strAccessCode) Checks if a given login is already in usestatic intcheckEmailAlreadyInUse(String strEmail) Checks if a given email is already in usestatic booleancheckRoleAttributed(String strRoleKey) Checks wether the role is in use or notstatic intcountUserPasswordHistoryFromDate(Timestamp minDate, int nUserId) Get the number of password change done by a user since the given date.static voidstatic voidcreate(LuteceDefaultAdminUser user) static voidcreateRightForUser(int nUserId, String strRightId) static voidcreateRoleForUser(int nUserId, String strRoleId) Get the list of id of user with the expired status.static Collection<AdminUser>findByLevel(int nIdLevel) Get all users having a given levelstatic AdminUserfindByPrimaryKey(int nUserId) Get the user infos from user idstatic Collection<AdminUser>findByRight(String strIdRight) Get all users having a given rightstatic Collection<AdminUser>findByRole(String strRoleKey) Get all users having a given rolestatic LuteceDefaultAdminUserfindLuteceDefaultAdminUserByPrimaryKey(int nUserId) Get the user infos from user idstatic StringfindUserByEmail(String strEmail) Get the user access code from its email.static Collection<AdminUser>findUserByFilter(AdminUserFilter auFilter) Get all users by using a filter.static AdminUserfindUserByLogin(String strUserLogin) Get the user infos from the access code.static <T extends AdminUser>
TfindUserByLogin(String strUserLogin, T user) Get the user infos from the access code.static Collection<AdminUser>Get a map of anonymization status of a user field.getIdUsersToSendFirstAlert(Timestamp firstAlertMaxDate) 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 flaggetRightsListForUser(int nUserId) Get the right list associated to a given user idgetRolesListForUser(int nUserId) Get the role list associated to a given user idstatic StringgetUserPasswordResetToken(int nIdUser, Date timestamp, String strSessionId) Construct a password reset token.getUsersWithLifeTimeToResync(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.static booleanCheck if the user has the given rightstatic booleanCheck if the user has the rolestatic voidinsertNewPasswordInHistory(IPassword password, int nUserId) Log a password change in the password historystatic voidremove(int nUserId) static voidstatic voidstatic voidremoveAllPasswordHistoryForUser(int nUserId) Remove every password saved in the password history for a user.static voidremoveAllRightsForUser(int nUserId) static voidremoveAllRolesForUser(int nUserId) static voidremoveRightForUser(int nUserId, String strIdRight) Remove a right for an userstatic voidremoveRoleForUser(int nUserId, String strRoleKey) Remove role for an userselectUserPasswordHistory(int nUserID) Gets the history of password of the given userstatic voidstatic voidupdate(LuteceDefaultAdminUser user) static voidupdate(LuteceDefaultAdminUser user, PasswordUpdateMode passwordMode) static voidupdateAnonymizationStatusUserStaticField(String strFieldName, boolean bAnonymizeFiled) Update the anonymization status of a user field.static voidupdateChangePassword(List<Integer> listIdUser) Set the "change password" flag of users to truestatic voidupdateDateLastLogin(int nIdUser, Timestamp dateLastLogin) Update the admin user last login date.static voidupdateNbAlert(List<Integer> listIdUser) Increment the number of alert send to users by 1static voidupdateUserExpirationDate(int nIdUser, Timestamp newExpirationDate) Update the admin user expiration date with the new values.static voidupdateUsersRole(String strOldRoleKey, RBACRole role) Update role key if role key name has changestatic voidupdateUserStatus(List<Integer> listIdUser, int nNewStatus) Update status of a list of user accounts
-
Method Details
-
findUserByLogin
Get the user infos from the access code.- Parameters:
strUserLogin- the login- Returns:
- user info
-
findUserByLogin
Get the user infos from the access code.- Parameters:
strUserLogin- the loginuser- the user to load- Returns:
- user info
-
findUserByEmail
Get the user access code from its email.- Parameters:
strEmail- The email- Returns:
- The access code of the user with the given email, or null if no user has been found
-
findByPrimaryKey
Get the user infos from user id- Parameters:
nUserId- the user identifier- Returns:
- The user
-
findUserList
- Returns:
- the user list
-
create
- Parameters:
user- The AdminUser
-
update
- Parameters:
user- The AdminUser
-
remove
public static void remove(int nUserId) - Parameters:
nUserId- the user identifier
-
getRightsListForUser
Get the right list associated to a given user id- Parameters:
nUserId- the id of the user to retrieve rights- Returns:
- the right list
-
createRightForUser
- Parameters:
nUserId- The user identifierstrRightId- The right identifier
-
removeAllRightsForUser
public static void removeAllRightsForUser(int nUserId) - Parameters:
nUserId- The user identifier
-
removeAllDelegatedRightsForUser
- Parameters:
user- The Admin User object
-
removeAllOwnRightsForUser
- Parameters:
user- The Admin User object
-
getRolesListForUser
Get the role list associated to a given user id- Parameters:
nUserId- the id of the user to retrieve rights- Returns:
- the role list
-
createRoleForUser
- Parameters:
nUserId- the id of the userstrRoleId- the role identifier
-
removeAllRolesForUser
public static void removeAllRolesForUser(int nUserId) - Parameters:
nUserId- the user identifier
-
checkRoleAttributed
Checks wether the role is in use or not- Parameters:
strRoleKey- the role key to check- Returns:
- true if the role is attributed, false otherwise
-
checkAccessCodeAlreadyInUse
Checks if a given login is already in use- Parameters:
strAccessCode- The login- Returns:
- user ID if the access code is already used by another user, -1 otherwise
-
checkEmailAlreadyInUse
Checks if a given email is already in use- Parameters:
strEmail- The email- Returns:
- user ID if the email is already used by another user, -1 otherwise
-
hasRole
Check if the user has the role- Parameters:
user- The AdminUserstrRoleKey- The role Key- Returns:
- true if the user has the role
-
removeRoleForUser
Remove role for an user- Parameters:
nUserId- The ID of the userstrRoleKey- The role key
-
create
- Parameters:
user- the LuteceDefaultAdminUSer
-
update
- Parameters:
user- the LuteceDefaultAdminUSer
-
update
- Parameters:
user- the LuteceDefaultAdminUSerpasswordMode- should the password be updated or not
-
findLuteceDefaultAdminUserByPrimaryKey
Get the user infos from user id- Parameters:
nUserId- the user identifier- Returns:
- the delfault admin user
-
findByRole
Get all users having a given role- Parameters:
strRoleKey- The role key- Returns:
- A collection of AdminUser
-
findByLevel
Get all users having a given level- Parameters:
nIdLevel- The level- Returns:
- A collection of AdminUser
-
updateUsersRole
Update role key if role key name has change- Parameters:
strOldRoleKey- The old role key namerole- The new role
-
findUserByFilter
Get all users by using a filter.- Parameters:
auFilter- The filter- Returns:
- A collection of AdminUser
-
findByRight
Get all users having a given right- Parameters:
strIdRight- The ID right- Returns:
- A collection of AdminUser
-
hasRight
Check if the user has the given right- Parameters:
user- The Admin UserstrIdRight- The ID right- Returns:
- true if the user has the right
-
removeRightForUser
Remove a right for an user- Parameters:
nUserId- The user IDstrIdRight- The right ID
-
selectUserPasswordHistory
Gets the history of password of the given user- 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.- 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- Parameters:
password- New password of the usernUserId- Id of the user
-
removeAllPasswordHistoryForUser
public static void removeAllPasswordHistoryForUser(int nUserId) Remove every password saved in the password history for a user.- Parameters:
nUserId- Id of the user
-
getAnonymizationStatusUserStaticField
Get a map of anonymization status of a user field.- Returns:
- A map containing the associations of user field name and a boolean describing whether the field should be anonymized.
-
updateAnonymizationStatusUserStaticField
public static void updateAnonymizationStatusUserStaticField(String strFieldName, boolean bAnonymizeFiled) Update the anonymization status of a user field.- Parameters:
strFieldName- Name of the field to updatebAnonymizeFiled- True if the field should be anonymize, false otherwise
-
findAllExpiredUserId
Get the list of id of user with the expired status.- 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- 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. Only the id, the status, the account max valid date and the last login date of the returned users are set.- 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- Parameters:
firstAlertMaxDate- The maximum expiration date to send first alert.- Returns:
- the list of id of users that need to receive their first alert
-
getIdUsersToSendOtherAlert
public static List<Integer> getIdUsersToSendOtherAlert(Timestamp alertMaxDate, Timestamp timeBetweenAlerts, int maxNumberAlerts) Get the list of id of users that need to receive their first alert- 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- 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- Parameters:
listIdUser- List of user accounts to updatenNewStatus- New status of the user
-
updateNbAlert
Increment the number of alert send to users by 1- Parameters:
listIdUser- The list of users to update
-
updateChangePassword
Set the "change password" flag of users to true- 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- Parameters:
nIdUser- Id of the admin user to updatenewExpirationDate- Id of the user to update
-
updateDateLastLogin
Update the admin user last login date.- Parameters:
nIdUser- Id of the admin user to updatedateLastLogin- New last login date of the user
-
getUserPasswordResetToken
Construct a password reset token. Use the numerical userId as it does not change. Use the stored password, so that the token is invalidated if the password is changed. Use a timestamp to allow limiting the validity of the token in time. Optionally bind the token to the user session. Finally return an HMAC of this info using the application crypto key.- Parameters:
nIdUser- the user IDtimestamp- the timestampstrSessionId- the session ID- Returns:
- the password reset token
-