Class DatabaseUserHome
- java.lang.Object
-
- fr.paris.lutece.plugins.mylutece.modules.database.authentication.business.DatabaseUserHome
-
public final class DatabaseUserHome extends java.lang.ObjectThis class provides instances management methods (create, find, ...) for DatabaseUser objects
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancheckPassword(java.lang.String strLogin, java.lang.String strPassword, fr.paris.lutece.portal.service.plugin.Plugin plugin)Check the password for a DatabaseUserstatic intcountUserPasswordHistoryFromDate(java.sql.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.static DatabaseUsercreate(DatabaseUser databaseUser, fr.paris.lutece.util.password.IPassword password, fr.paris.lutece.portal.service.plugin.Plugin plugin)Creation of an instance of databaseUserstatic java.util.List<java.lang.Integer>findAllExpiredUserId(fr.paris.lutece.portal.service.plugin.Plugin plugin)Get the list of id of user with the expired status.static java.util.List<DatabaseUser>findByIds(java.util.List<java.lang.Integer> userIds, fr.paris.lutece.portal.service.plugin.Plugin plugin)Load multiple users by their IDsstatic DatabaseUserfindByPrimaryKey(int nKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)Returns an instance of a DatabaseUser whose identifier is specified in parameterstatic intfindDatabaseUserIdFromLogin(java.lang.String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)Get a user id from his loginstatic java.util.Collection<DatabaseUser>findDatabaseUsersList(fr.paris.lutece.portal.service.plugin.Plugin plugin)Returns a collection of DatabaseUser objectsstatic java.util.List<DatabaseUser>findDatabaseUsersListByFilter(DatabaseUserFilter duFilter, fr.paris.lutece.portal.service.plugin.Plugin plugin)Find DatabaseUsers by filterstatic java.util.Collection<DatabaseUser>findDatabaseUsersListForEmail(java.lang.String strEmail, fr.paris.lutece.portal.service.plugin.Plugin plugin)Returns a collection of DatabaseUser objects for a emailstatic java.util.Collection<DatabaseUser>findDatabaseUsersListForLogin(java.lang.String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)Returns a collection of DatabaseUser objects for a loginstatic java.util.List<java.lang.Integer>getIdUsersToSendFirstAlert(java.sql.Timestamp firstAlertMaxDate, fr.paris.lutece.portal.service.plugin.Plugin plugin)Get the list of id of users that need to receive their first alertstatic java.util.List<java.lang.Integer>getIdUsersToSendOtherAlert(java.sql.Timestamp alertMaxDate, java.sql.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 alertstatic java.util.List<java.lang.Integer>getIdUsersWithExpiredLifeTimeList(java.sql.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 statusstatic java.util.List<java.lang.Integer>getIdUsersWithExpiredPasswordsList(java.sql.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 flagstatic intgetNbAccountLifeTimeNotification(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 accountstatic 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 historystatic voidremove(DatabaseUser databaseUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)Remove the databaseUser whose identifier is specified in parameterstatic voidremoveAllPasswordHistoryForUser(int nUserId, fr.paris.lutece.portal.service.plugin.Plugin plugin)Remove every password saved in the password history for a user.static java.util.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 userstatic DatabaseUserupdate(DatabaseUser databaseUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)Update of the databaseUser which is specified in parameterstatic voidupdateChangePassword(java.util.List<java.lang.Integer> listIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)Set the "change password" flag of users to truestatic voidupdateNbAlert(java.util.List<java.lang.Integer> listIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)Increment the number of alert send to users by 1static DatabaseUserupdatePassword(DatabaseUser databaseUser, fr.paris.lutece.util.password.IPassword newPassword, fr.paris.lutece.portal.service.plugin.Plugin plugin)Update of the databaseUser which is specified in parameterstatic DatabaseUserupdateResetPassword(DatabaseUser user, boolean bNewValue, fr.paris.lutece.portal.service.plugin.Plugin plugin)Update of the databaseUser which is specified in parameterstatic voidupdateUserExpirationDate(int nIdUser, java.sql.Timestamp newExpirationDate, fr.paris.lutece.portal.service.plugin.Plugin plugin)Update the user expiration date with the new values.static voidupdateUserLastLoginDate(java.lang.String strLogin, java.util.Date dateLastLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)Update a user last login datestatic voidupdateUserStatus(java.util.List<java.lang.Integer> listIdUser, int nNewStatus, fr.paris.lutece.portal.service.plugin.Plugin plugin)Update status of a list of user accounts
-
-
-
Method Detail
-
create
public static DatabaseUser create(DatabaseUser databaseUser, fr.paris.lutece.util.password.IPassword password, fr.paris.lutece.portal.service.plugin.Plugin plugin)
Creation of an instance of databaseUser- Parameters:
databaseUser- The instance of the DatabaseUser which contains the informations to storepassword- The user's passwordplugin- The current plugin using this method- Returns:
- The instance of DatabaseUser which has been created with its primary key.
-
update
public static DatabaseUser update(DatabaseUser databaseUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)
Update of the databaseUser which is specified in parameter- Parameters:
databaseUser- The instance of the DatabaseUser which contains the data to storeplugin- The current plugin using this method- Returns:
- The instance of the DatabaseUser which has been updated
-
updatePassword
public static DatabaseUser updatePassword(DatabaseUser databaseUser, fr.paris.lutece.util.password.IPassword newPassword, fr.paris.lutece.portal.service.plugin.Plugin plugin)
Update of the databaseUser which is specified in parameter- Parameters:
databaseUser- The instance of the DatabaseUser which contains the data to storenewPassword- The new password to storeplugin- The current plugin using this method- Returns:
- The instance of the DatabaseUser which has been updated
-
updateResetPassword
public static DatabaseUser updateResetPassword(DatabaseUser user, boolean bNewValue, fr.paris.lutece.portal.service.plugin.Plugin plugin)
Update of the databaseUser which is specified in parameter- Parameters:
user- The instance of the DatabaseUser which contains the data to storebNewValue- The new value of the reset password attributeplugin- The current plugin using this method- Returns:
- The instance of the DatabaseUser which has been updated
-
remove
public static void remove(DatabaseUser databaseUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)
Remove the databaseUser whose identifier is specified in parameter- Parameters:
databaseUser- The DatabaseUser object to removeplugin- The current plugin using this method
-
findByPrimaryKey
public static DatabaseUser findByPrimaryKey(int nKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
Returns an instance of a DatabaseUser whose identifier is specified in parameter- Parameters:
nKey- The Primary key of the databaseUserplugin- The current plugin using this method- Returns:
- An instance of DatabaseUser
-
findDatabaseUsersList
public static java.util.Collection<DatabaseUser> findDatabaseUsersList(fr.paris.lutece.portal.service.plugin.Plugin plugin)
Returns a collection of DatabaseUser objects- Parameters:
plugin- The current plugin using this method- Returns:
- A collection of DatabaseUser
-
findDatabaseUsersListForLogin
public static java.util.Collection<DatabaseUser> findDatabaseUsersListForLogin(java.lang.String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)
Returns a collection of DatabaseUser objects for a login- Parameters:
strLogin- The login of the databseUserplugin- The current plugin using this method- Returns:
- A collection of DatabaseUser
-
findDatabaseUsersListForEmail
public static java.util.Collection<DatabaseUser> findDatabaseUsersListForEmail(java.lang.String strEmail, fr.paris.lutece.portal.service.plugin.Plugin plugin)
Returns a collection of DatabaseUser objects for a email- Parameters:
strEmail- The email of the databseUserplugin- The current plugin using this method- Returns:
- A collection of DatabaseUser
-
checkPassword
public static boolean checkPassword(java.lang.String strLogin, java.lang.String strPassword, fr.paris.lutece.portal.service.plugin.Plugin plugin)Check the password for a DatabaseUser- Parameters:
strLogin- The user login of DatabaseUserstrPassword- The password of DatabaseUserplugin- The Plugin using this data access service- Returns:
- true if password is ok
-
findDatabaseUsersListByFilter
public static java.util.List<DatabaseUser> findDatabaseUsersListByFilter(DatabaseUserFilter duFilter, fr.paris.lutece.portal.service.plugin.Plugin plugin)
Find DatabaseUsers by filter- Parameters:
duFilter- filterplugin- The plugin- Returns:
- a list of DatabaseUsers
-
findDatabaseUserIdFromLogin
public static int findDatabaseUserIdFromLogin(java.lang.String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)Get a user id from his login- Parameters:
strLogin- The login of the userplugin- The plugin- Returns:
- The user id, or 0 if no user has this login.
-
selectUserPasswordHistory
public static java.util.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- Parameters:
nUserID- Id of the userplugin- The plugin- Returns:
- The collection of recent passwords used by the user.
-
countUserPasswordHistoryFromDate
public static int countUserPasswordHistoryFromDate(java.sql.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.- 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 static 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- Parameters:
strPassword- New password of the usernUserId- Id of the userplugin- The plugin
-
removeAllPasswordHistoryForUser
public static void removeAllPasswordHistoryForUser(int nUserId, fr.paris.lutece.portal.service.plugin.Plugin plugin)Remove every password saved in the password history for a user.- Parameters:
nUserId- Id of the userplugin- The plugin
-
findAllExpiredUserId
public static java.util.List<java.lang.Integer> findAllExpiredUserId(fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the list of id of user with the expired status.- Parameters:
plugin- The plugin- Returns:
- The list of id of user with the expired status.
-
getIdUsersWithExpiredLifeTimeList
public static java.util.List<java.lang.Integer> getIdUsersWithExpiredLifeTimeList(java.sql.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- Parameters:
currentTimestamp- Timestamp describing the current time.plugin- The plugin- Returns:
- the list of id of users with expired time life
-
getIdUsersToSendFirstAlert
public static java.util.List<java.lang.Integer> getIdUsersToSendFirstAlert(java.sql.Timestamp firstAlertMaxDate, fr.paris.lutece.portal.service.plugin.Plugin plugin)Get the list of id of users that need to receive their first alert- Parameters:
firstAlertMaxDate- The maximum expiration date to send first alert.plugin- The plugin- Returns:
- the list of id of users that need to receive their first alert
-
getIdUsersToSendOtherAlert
public static java.util.List<java.lang.Integer> getIdUsersToSendOtherAlert(java.sql.Timestamp alertMaxDate, java.sql.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- 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 static java.util.List<java.lang.Integer> getIdUsersWithExpiredPasswordsList(java.sql.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- Parameters:
currentTimestamp- Timestamp describing the current time.plugin- The plugin- Returns:
- the list of id of users with expired passwords
-
updateUserStatus
public static void updateUserStatus(java.util.List<java.lang.Integer> listIdUser, int nNewStatus, fr.paris.lutece.portal.service.plugin.Plugin plugin)Update status of a list of user accounts- Parameters:
listIdUser- List of user accounts to updatenNewStatus- New status of the userplugin- The plugin
-
updateNbAlert
public static void updateNbAlert(java.util.List<java.lang.Integer> listIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)Increment the number of alert send to users by 1- Parameters:
listIdUser- The list of users to updateplugin- The plugin
-
updateChangePassword
public static void updateChangePassword(java.util.List<java.lang.Integer> listIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)Set the "change password" flag of users to true- Parameters:
listIdUser- The list of users to updateplugin- The plugin
-
updateUserExpirationDate
public static void updateUserExpirationDate(int nIdUser, java.sql.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- Parameters:
nIdUser- Id of the user to updatenewExpirationDate- Id of the user to updateplugin- The plugin
-
getNbAccountLifeTimeNotification
public static 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- Parameters:
nIdUser- Id of the userplugin- The plugin- Returns:
- The number of notification send to the user
-
updateUserLastLoginDate
public static void updateUserLastLoginDate(java.lang.String strLogin, java.util.Date dateLastLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)Update a user last login date- Parameters:
strLogin- Login of the user to updatedateLastLogin- date of the last login of the userplugin- The plugin
-
findByIds
public static java.util.List<DatabaseUser> findByIds(java.util.List<java.lang.Integer> userIds, fr.paris.lutece.portal.service.plugin.Plugin plugin)
Load multiple users by their IDs- Parameters:
userIds- The list of user IDsplugin- The plugin- Returns:
- The list of DatabaseUsers found
-
-