Class DatabaseUserDAO
java.lang.Object
fr.paris.lutece.plugins.mylutece.modules.database.authentication.business.DatabaseUserDAO
- All Implemented Interfaces:
IDatabaseUserDAO
This class provides Data Access methods for databaseUser objects
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcountUserPasswordHistoryFromDate(Timestamp minDate, int nUserId, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get the number of password change done by a user since the given date.voiddelete(DatabaseUser databaseUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Delete a record from the tablefindAllExpiredUserId(fr.paris.lutece.portal.service.plugin.Plugin plugin) Get the list of id of user with the expired status.intfindDatabaseUserIdFromLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get a user id from his logingetIdUsersToSendFirstAlert(Timestamp alertMaxDate, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get the list of id of users that need to receive their first alertgetIdUsersToSendOtherAlert(Timestamp alertMaxDate, Timestamp timeBetweenAlerts, int maxNumberAlerts, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get the list of id of users that need to receive their first alertgetIdUsersWithExpiredLifeTimeList(Timestamp currentTimestamp, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get the list of id of users that have an expired time life but not the expired statusgetIdUsersWithExpiredPasswordsList(Timestamp currentTimestamp, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get the list of id of users that have an expired password but not the change password flagintgetNbAccountLifeTimeNotification(int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get the number of notification send to a user to warn him about the expiration of his accountvoidinsert(DatabaseUser databaseUser, fr.paris.lutece.util.password.IPassword password, fr.paris.lutece.portal.service.plugin.Plugin plugin) Insert a new record in the table.voidinsertNewPasswordInHistory(fr.paris.lutece.util.password.IPassword password, int nUserId, fr.paris.lutece.portal.service.plugin.Plugin plugin) Log a password change in the password historyload(int nUserId, fr.paris.lutece.portal.service.plugin.Plugin plugin) Load the data of DatabaseUser from the tablefr.paris.lutece.util.password.IPasswordloadPassword(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) load the password for a DatabaseUserloadUsersByIds(List<Integer> userIds, fr.paris.lutece.portal.service.plugin.Plugin plugin) Load multiple users by their IDsintnewPrimaryKey(fr.paris.lutece.portal.service.plugin.Plugin plugin) Generates a new primary keyvoidremoveAllPasswordHistoryForUser(int nUserId, fr.paris.lutece.portal.service.plugin.Plugin plugin) Remove every password saved in the password history for a user.selectDatabaseUserList(fr.paris.lutece.portal.service.plugin.Plugin plugin) Load the list of databaseUsersselectDatabaseUserListForEmail(String strEmail, fr.paris.lutece.portal.service.plugin.Plugin plugin) Load the list of DatabaseUsers for a emailselectDatabaseUserListForLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Load the list of DatabaseUsers for a loginselectDatabaseUsersListByFilter(DatabaseUserFilter duFilter, fr.paris.lutece.portal.service.plugin.Plugin plugin) Load the list of DatabaseUsers by a filterList<fr.paris.lutece.util.password.IPassword>selectUserPasswordHistory(int nUserID, fr.paris.lutece.portal.service.plugin.Plugin plugin) Gets the history of password of the given uservoidstore(DatabaseUser databaseUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update the record in the tablevoidupdateChangePassword(List<Integer> listIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Set the "change password" flag of users to truevoidupdateNbAlert(List<Integer> listIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Increment the number of alert send to users by 1voidupdatePassword(DatabaseUser databaseUser, fr.paris.lutece.util.password.IPassword newPassword, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update the record in the tablevoidupdateResetPassword(DatabaseUser databaseUser, boolean bNewValue, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update the record in the tablevoidupdateUserExpirationDate(int nIdUser, Timestamp newExpirationDate, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update the user expiration date with the new values.voidupdateUserLastLoginDate(String strLogin, Timestamp dateLastLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update a user last login datevoidupdateUserStatus(List<Integer> listIdUser, int nNewStatus, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update status of a list of user accounts
-
Constructor Details
-
DatabaseUserDAO
public DatabaseUserDAO()
-
-
Method Details
-
newPrimaryKey
public int newPrimaryKey(fr.paris.lutece.portal.service.plugin.Plugin plugin) Generates a new primary key- Specified by:
newPrimaryKeyin interfaceIDatabaseUserDAO- Parameters:
plugin- The Plugin using this data access service- Returns:
- The new primary key
-
insert
public void insert(DatabaseUser databaseUser, fr.paris.lutece.util.password.IPassword password, fr.paris.lutece.portal.service.plugin.Plugin plugin) Insert a new record in the table.- Specified by:
insertin interfaceIDatabaseUserDAO- Parameters:
databaseUser- The databaseUser objectpassword- The user passwordplugin- The Plugin using this data access service
-
load
Load the data of DatabaseUser from the table- Specified by:
loadin interfaceIDatabaseUserDAO- Parameters:
nUserId- The identifier of databaseUserplugin- The Plugin using this data access service- Returns:
- the instance of the DatabaseUser
-
delete
Delete a record from the table- Specified by:
deletein interfaceIDatabaseUserDAO- Parameters:
databaseUser- The databaseUser objectplugin- The Plugin using this data access service
-
store
Update the record in the table- Specified by:
storein interfaceIDatabaseUserDAO- Parameters:
databaseUser- The reference of databaseUserplugin- The Plugin using this data access service
-
updatePassword
public void updatePassword(DatabaseUser databaseUser, fr.paris.lutece.util.password.IPassword newPassword, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update the record in the table- Specified by:
updatePasswordin interfaceIDatabaseUserDAO- Parameters:
databaseUser- The reference of databaseUsernewPassword- The new password to storeplugin- The Plugin using this data access service
-
updateResetPassword
public void updateResetPassword(DatabaseUser databaseUser, boolean bNewValue, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update the record in the table- Specified by:
updateResetPasswordin interfaceIDatabaseUserDAO- Parameters:
databaseUser- The reference of databaseUserbNewValue- The new value of the resetPassword attributeplugin- The Plugin using this data access service
-
selectDatabaseUserList
public Collection<DatabaseUser> selectDatabaseUserList(fr.paris.lutece.portal.service.plugin.Plugin plugin) Load the list of databaseUsers- Specified by:
selectDatabaseUserListin interfaceIDatabaseUserDAO- Parameters:
plugin- The Plugin using this data access service- Returns:
- The Collection of the databaseUsers
-
selectDatabaseUserListForLogin
public Collection<DatabaseUser> selectDatabaseUserListForLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Load the list of DatabaseUsers for a login- Specified by:
selectDatabaseUserListForLoginin interfaceIDatabaseUserDAO- Parameters:
strLogin- The login of DatabaseUserplugin- The Plugin using this data access service- Returns:
- The Collection of the DatabaseUsers
-
selectDatabaseUserListForEmail
public Collection<DatabaseUser> selectDatabaseUserListForEmail(String strEmail, fr.paris.lutece.portal.service.plugin.Plugin plugin) Load the list of DatabaseUsers for a email- Specified by:
selectDatabaseUserListForEmailin interfaceIDatabaseUserDAO- Parameters:
strEmail- The email of DatabaseUserplugin- The Plugin using this data access service- Returns:
- The Collection of the DatabaseUsers
-
loadPassword
public fr.paris.lutece.util.password.IPassword loadPassword(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) load the password for a DatabaseUser- Specified by:
loadPasswordin interfaceIDatabaseUserDAO- Parameters:
strLogin- The user login of DatabaseUserplugin- The Plugin using this data access service- Returns:
- the stored password of the user
-
selectDatabaseUsersListByFilter
public List<DatabaseUser> selectDatabaseUsersListByFilter(DatabaseUserFilter duFilter, fr.paris.lutece.portal.service.plugin.Plugin plugin) Load the list of DatabaseUsers by a filter- Specified by:
selectDatabaseUsersListByFilterin interfaceIDatabaseUserDAO- Parameters:
duFilter- filterplugin- Plugin- Returns:
- a list of DatabaseUser
-
findDatabaseUserIdFromLogin
public int findDatabaseUserIdFromLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get a user id from his login- Specified by:
findDatabaseUserIdFromLoginin interfaceIDatabaseUserDAO- Parameters:
strLogin- The login of the userplugin- The plugin- Returns:
- The user id, or 0 if no user has this login.
-
selectUserPasswordHistory
public List<fr.paris.lutece.util.password.IPassword> selectUserPasswordHistory(int nUserID, fr.paris.lutece.portal.service.plugin.Plugin plugin) Gets the history of password of the given user- Specified by:
selectUserPasswordHistoryin interfaceIDatabaseUserDAO- Parameters:
nUserID- Id of the userplugin- The plugin- Returns:
- The collection of recent passwords used by the user.
-
countUserPasswordHistoryFromDate
public int countUserPasswordHistoryFromDate(Timestamp minDate, int nUserId, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get the number of password change done by a user since the given date.- Specified by:
countUserPasswordHistoryFromDatein interfaceIDatabaseUserDAO- Parameters:
minDate- Minimum date to consider.nUserId- Id of the userplugin- The plugin- Returns:
- The number of password change done by the user since the given date.
-
insertNewPasswordInHistory
public void insertNewPasswordInHistory(fr.paris.lutece.util.password.IPassword password, int nUserId, fr.paris.lutece.portal.service.plugin.Plugin plugin) Log a password change in the password history- Specified by:
insertNewPasswordInHistoryin interfaceIDatabaseUserDAO- Parameters:
password- New password of the usernUserId- Id of the userplugin- The plugin
-
removeAllPasswordHistoryForUser
public void removeAllPasswordHistoryForUser(int nUserId, fr.paris.lutece.portal.service.plugin.Plugin plugin) Remove every password saved in the password history for a user.- Specified by:
removeAllPasswordHistoryForUserin interfaceIDatabaseUserDAO- Parameters:
nUserId- Id of the userplugin- The plugin
-
findAllExpiredUserId
Get the list of id of user with the expired status.- Specified by:
findAllExpiredUserIdin interfaceIDatabaseUserDAO- Parameters:
plugin- The plugin- Returns:
- The list of if of user with the expired status.
-
getIdUsersWithExpiredLifeTimeList
public List<Integer> getIdUsersWithExpiredLifeTimeList(Timestamp currentTimestamp, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get the list of id of users that have an expired time life but not the expired status- Specified by:
getIdUsersWithExpiredLifeTimeListin interfaceIDatabaseUserDAO- Parameters:
currentTimestamp- Timestamp describing the current time.plugin- The plugin- Returns:
- the list of id of users with expired time life
-
getIdUsersToSendFirstAlert
public List<Integer> getIdUsersToSendFirstAlert(Timestamp alertMaxDate, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get the list of id of users that need to receive their first alert- Specified by:
getIdUsersToSendFirstAlertin interfaceIDatabaseUserDAO- Parameters:
alertMaxDate- The maximum date to send alerts.plugin- The plugin- 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, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get the list of id of users that need to receive their first alert- Specified by:
getIdUsersToSendOtherAlertin interfaceIDatabaseUserDAO- 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 userplugin- The plugin- Returns:
- the list of id of users that need to receive their first alert
-
getIdUsersWithExpiredPasswordsList
public List<Integer> getIdUsersWithExpiredPasswordsList(Timestamp currentTimestamp, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get the list of id of users that have an expired password but not the change password flag- Specified by:
getIdUsersWithExpiredPasswordsListin interfaceIDatabaseUserDAO- Parameters:
currentTimestamp- Timestamp describing the current time.plugin- The plugin- Returns:
- the list of id of users with expired passwords
-
updateUserStatus
public void updateUserStatus(List<Integer> listIdUser, int nNewStatus, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update status of a list of user accounts- Specified by:
updateUserStatusin interfaceIDatabaseUserDAO- Parameters:
listIdUser- List of user accounts to updatenNewStatus- New status of the userplugin- The plugin
-
updateNbAlert
public void updateNbAlert(List<Integer> listIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Increment the number of alert send to users by 1- Specified by:
updateNbAlertin interfaceIDatabaseUserDAO- Parameters:
listIdUser- The list of users to updateplugin- The plugin
-
updateChangePassword
public void updateChangePassword(List<Integer> listIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Set the "change password" flag of users to true- Specified by:
updateChangePasswordin interfaceIDatabaseUserDAO- Parameters:
listIdUser- The list of users to updateplugin- The plugin
-
updateUserExpirationDate
public void updateUserExpirationDate(int nIdUser, Timestamp newExpirationDate, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update the user expiration date with the new values. Also update his alert account to 0- Specified by:
updateUserExpirationDatein interfaceIDatabaseUserDAO- Parameters:
nIdUser- Id of the user to updatenewExpirationDate- Id of the user to updateplugin- The plugin
-
getNbAccountLifeTimeNotification
public int getNbAccountLifeTimeNotification(int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get the number of notification send to a user to warn him about the expiration of his account- Specified by:
getNbAccountLifeTimeNotificationin interfaceIDatabaseUserDAO- Parameters:
nIdUser- Id of the userplugin- The plugin- Returns:
- The number of notification send to the user
-
updateUserLastLoginDate
public void updateUserLastLoginDate(String strLogin, Timestamp dateLastLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update a user last login date- Specified by:
updateUserLastLoginDatein interfaceIDatabaseUserDAO- Parameters:
strLogin- Login of the user to updatedateLastLogin- date of the last login of the userplugin- The plugin
-
loadUsersByIds
public List<DatabaseUser> loadUsersByIds(List<Integer> userIds, fr.paris.lutece.portal.service.plugin.Plugin plugin) Load multiple users by their IDs- Specified by:
loadUsersByIdsin interfaceIDatabaseUserDAO- Parameters:
userIds- The list of user IDsplugin- The plugin- Returns:
- The list of DatabaseUsers found
-