fr.paris.lutece.portal.business.user
Class AdminUserHome

java.lang.Object
  extended by fr.paris.lutece.portal.business.user.AdminUserHome

public final class AdminUserHome
extends Object

This class provides instances management methods (create, find, ...) for AdminUser objects


Method Summary
static int checkAccessCodeAlreadyInUse(String strAccessCode)
          Checks if a given login is already in use
static int checkEmailAlreadyInUse(String strEmail)
          Checks if a given email is already in use
static boolean checkRoleAttributed(String strRoleKey)
          Checks wether the role is in use or not
static int countUserPasswordHistoryFromDate(Timestamp minDate, int nUserId)
          Get the number of password change done by a user since the given date.
static void create(AdminUser user)
           
static void create(LuteceDefaultAdminUser user)
           
static void createRightForUser(int nUserId, String strRightId)
           
static void createRoleForUser(int nUserId, String strRightId)
           
static List<Integer> findAllExpiredUserId()
          Get the list of id of user with the expired status.
static Collection<AdminUser> findByLevel(int nIdLevel)
          Get all users having a given level
static AdminUser findByPrimaryKey(int nUserId)
          Get the user infos from user id
static Collection<AdminUser> findByRight(String strIdRight)
          Get all users having a given right
static Collection<AdminUser> findByRole(String strRoleKey)
          Get all users having a given role
static LuteceDefaultAdminUser findLuteceDefaultAdminUserByPrimaryKey(int nUserId)
          Get the user infos from user id
static String findUserByEmail(String strEmail)
          Get the user access code from its email.
static Collection<AdminUser> findUserByFilter(AdminUserFilter auFilter)
          Get all users by using a filter.
static AdminUser findUserByLogin(String strUserLogin)
          Get the user infos from the access code.
static Collection<AdminUser> findUserList()
           
static Map<String,Boolean> getAnonymizationStatusUserStaticField()
          Get a map of anonymization status of a user field.
static List<Integer> getIdUsersToSendFirstAlert(Timestamp firstAlertMaxDate)
          Get the list of id of users that need to receive their first alert
static List<Integer> getIdUsersToSendOtherAlert(Timestamp alertMaxDate, Timestamp timeBetweenAlerts, int maxNumberAlerts)
          Get the list of id of users that need to receive their first alert
static List<Integer> getIdUsersWithExpiredLifeTimeList(Timestamp currentTimestamp)
          Get the list of id of users that have an expired time life but not the expired status
static List<Integer> getIdUsersWithExpiredPasswordsList(Timestamp currentTimestamp)
          Get the list of id of users that have an expired password but not the change password flag
static Map<String,Right> getRightsListForUser(int nUserId)
          Get the right list associated to a given user id
static Map<String,AdminRole> getRolesListForUser(int nUserId)
          Get the role list associated to a given user id
static boolean hasRight(AdminUser user, String strIdRight)
          Check if the user has the given right
static boolean hasRole(AdminUser user, String strRoleKey)
          Check if the user has the role
static void insertNewPasswordInHistory(String strPassword, int nUserId)
          Log a password change in the password history
static void remove(int nUserId)
           
static void removeAllDelegatedRightsForUser(AdminUser user)
           
static void removeAllOwnRightsForUser(AdminUser user)
           
static void removeAllPasswordHistoryForUser(int nUserId)
          Remove every password saved in the password history for a user.
static void removeAllRightsForUser(int nUserId)
           
static void removeAllRolesForUser(int nUserId)
           
static void removeRightForUser(int nUserId, String strIdRight)
          Remove a right for an user
static void removeRoleForUser(int nUserId, String strRoleKey)
          Remove role for an user
static List<String> selectUserPasswordHistory(int nUserID)
          Gets the history of password of the given user
static void update(AdminUser user)
           
static void update(LuteceDefaultAdminUser user)
           
static void updateAnonymizationStatusUserStaticField(String strFieldName, boolean bAnonymizeFiled)
          Update the anonymization status of a user field.
static void updateChangePassword(List<Integer> listIdUser)
          Set the "change password" flag of users to true
static void updateDateLastLogin(int nIdUser, Timestamp dateLastLogin)
          Update the admin user last login date.
static void updateNbAlert(List<Integer> listIdUser)
          Increment the number of alert send to users by 1
static void updateUserExpirationDate(int nIdUser, Timestamp newExpirationDate)
          Update the admin user expiration date with the new values.
static void updateUsersRole(String strOldRoleKey, AdminRole role)
          Update role key if role key name has change
static void updateUserStatus(List<Integer> listIdUser, int nNewStatus)
          Update status of a list of user accounts
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

findUserByLogin

public static AdminUser findUserByLogin(String strUserLogin)
Get the user infos from the access code.

Parameters:
strUserLogin - the login
Returns:
user info

findUserByEmail

public static String findUserByEmail(String strEmail)
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

public static AdminUser findByPrimaryKey(int nUserId)
Get the user infos from user id

Parameters:
nUserId - the user identifier
Returns:
The user

findUserList

public static Collection<AdminUser> findUserList()
Returns:
the user list

create

public static void create(AdminUser user)
Parameters:
user - The AdminUser

update

public static void update(AdminUser user)
Parameters:
user - The AdminUser

remove

public static void remove(int nUserId)
Parameters:
nUserId - the user identifier

getRightsListForUser

public static Map<String,Right> getRightsListForUser(int nUserId)
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

public static void createRightForUser(int nUserId,
                                      String strRightId)
Parameters:
nUserId - The user identifier
strRightId - The right identifier

removeAllRightsForUser

public static void removeAllRightsForUser(int nUserId)
Parameters:
nUserId - The user identifier

removeAllDelegatedRightsForUser

public static void removeAllDelegatedRightsForUser(AdminUser user)
Parameters:
user - The Admin User object

removeAllOwnRightsForUser

public static void removeAllOwnRightsForUser(AdminUser user)
Parameters:
user - The Admin User object

getRolesListForUser

public static Map<String,AdminRole> getRolesListForUser(int nUserId)
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

public static void createRoleForUser(int nUserId,
                                     String strRightId)
Parameters:
nUserId - the id of the user
strRightId - the right identifier

removeAllRolesForUser

public static void removeAllRolesForUser(int nUserId)
Parameters:
nUserId - the user identifier

checkRoleAttributed

public static boolean checkRoleAttributed(String strRoleKey)
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

public static int checkAccessCodeAlreadyInUse(String strAccessCode)
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

public static int checkEmailAlreadyInUse(String strEmail)
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

public static boolean hasRole(AdminUser user,
                              String strRoleKey)
Check if the user has the role

Parameters:
user - The AdminUser
strRoleKey - The role Key
Returns:
true if the user has the role

removeRoleForUser

public static void removeRoleForUser(int nUserId,
                                     String strRoleKey)
Remove role for an user

Parameters:
nUserId - The ID of the user
strRoleKey - The role key

create

public static void create(LuteceDefaultAdminUser user)
Parameters:
user - the LuteceDefaultAdminUSer

update

public static void update(LuteceDefaultAdminUser user)
Parameters:
user - the LuteceDefaultAdminUSer

findLuteceDefaultAdminUserByPrimaryKey

public static LuteceDefaultAdminUser findLuteceDefaultAdminUserByPrimaryKey(int nUserId)
Get the user infos from user id

Parameters:
nUserId - the user identifier
Returns:
the delfault admin user

findByRole

public static Collection<AdminUser> findByRole(String strRoleKey)
Get all users having a given role

Parameters:
strRoleKey - The role key
Returns:
A collection of AdminUser

findByLevel

public static Collection<AdminUser> findByLevel(int nIdLevel)
Get all users having a given level

Parameters:
nIdLevel - The level
Returns:
A collection of AdminUser

updateUsersRole

public static void updateUsersRole(String strOldRoleKey,
                                   AdminRole role)
Update role key if role key name has change

Parameters:
strOldRoleKey - The old role key name
role - The new role

findUserByFilter

public static Collection<AdminUser> findUserByFilter(AdminUserFilter auFilter)
Get all users by using a filter.

Parameters:
auFilter - The filter
Returns:
A collection of AdminUser

findByRight

public static Collection<AdminUser> findByRight(String strIdRight)
Get all users having a given right

Parameters:
strIdRight - The ID right
Returns:
A collection of AdminUser

hasRight

public static boolean hasRight(AdminUser user,
                               String strIdRight)
Check if the user has the given right

Parameters:
user - The Admin User
strIdRight - The ID right
Returns:
true if the user has the right

removeRightForUser

public static void removeRightForUser(int nUserId,
                                      String strIdRight)
Remove a right for an user

Parameters:
nUserId - The user ID
strIdRight - The right ID

selectUserPasswordHistory

public static List<String> selectUserPasswordHistory(int nUserID)
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

public static int countUserPasswordHistoryFromDate(Timestamp minDate,
                                                   int nUserId)
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

public static void insertNewPasswordInHistory(String strPassword,
                                              int nUserId)
Log a password change in the password history

Parameters:
strPassword - New password of the user
nUserId - 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

public static Map<String,Boolean> 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 update
bAnonymizeFiled - True if the field should be anonymize, false otherwise

findAllExpiredUserId

public static List<Integer> findAllExpiredUserId()
Get the list of id of user with the expired status.

Returns:
The list of if of user with the expired status.

getIdUsersWithExpiredLifeTimeList

public static List<Integer> getIdUsersWithExpiredLifeTimeList(Timestamp currentTimestamp)
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

getIdUsersToSendFirstAlert

public static List<Integer> getIdUsersToSendFirstAlert(Timestamp firstAlertMaxDate)
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

public static List<Integer> getIdUsersWithExpiredPasswordsList(Timestamp currentTimestamp)
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

public static void updateUserStatus(List<Integer> listIdUser,
                                    int nNewStatus)
Update status of a list of user accounts

Parameters:
listIdUser - List of user accounts to update
nNewStatus - New status of the user

updateNbAlert

public static void updateNbAlert(List<Integer> listIdUser)
Increment the number of alert send to users by 1

Parameters:
listIdUser - The list of users to update

updateChangePassword

public static void updateChangePassword(List<Integer> listIdUser)
Set the "change password" flag of users to true

Parameters:
listIdUser - The list of users to update

updateUserExpirationDate

public static void updateUserExpirationDate(int nIdUser,
                                            Timestamp newExpirationDate)
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 update
newExpirationDate - Id of the user to update

updateDateLastLogin

public static void updateDateLastLogin(int nIdUser,
                                       Timestamp dateLastLogin)
Update the admin user last login date.

Parameters:
nIdUser - Id of the admin user to update
dateLastLogin - New last login date of the user


Copyright © 2014 Mairie de Paris. All Rights Reserved.