public class AdminUserDAO extends Object implements IAdminUserDAO
Constructor and Description |
---|
AdminUserDAO() |
Modifier and Type | Method and Description |
---|---|
int |
checkAccessCodeAlreadyInUse(String strAccessCode)
Checks the availibility of an access code
|
int |
checkEmailAlreadyInUse(String strEmail)
Checks the availibility of an email
|
boolean |
checkRoleAttributed(String strRoleKey)
Checks wether the role is in use or not
|
int |
countUserPasswordHistoryFromDate(Timestamp minDate,
int nUserId)
Get the number of password change done by a user since the given date.
|
void |
delete(int nUserId)
Delete an user
|
void |
deleteAllDelegatedRightsForUser(int nUserId,
int nUserLevel)
Deletes rights delegated by user ie rights with level < userlevel
|
void |
deleteAllOwnRightsForUser(int nUserId,
int nUserLevel)
Deletes all rights owned by user ie rights with level >= userlevel
|
void |
deleteAllRightsForUser(int nUserId)
Delete all rights owned by an user
|
void |
deleteAllRolesForUser(int nUserId)
Remove all rights from an user
|
void |
deleteRightForUser(int nUserId,
String strIdRight)
Remove a right for an user
|
void |
deleteRoleForUser(int nUserId,
String strRoleKey)
Remove role for an user
|
List<Integer> |
findAllExpiredUserId()
Get the list of id of user with the expired status.
|
List<Integer> |
getIdUsersToSendFirstAlert(Timestamp alertMaxDate)
Get the list of id of users that need to receive their first alert
|
List<Integer> |
getIdUsersToSendOtherAlert(Timestamp alertMaxDate,
Timestamp timeBetweenAlerts,
int maxNumberAlerts)
Get the list of id of users that need to receive their first alert
|
List<Integer> |
getIdUsersWithExpiredLifeTimeList(Timestamp currentTimestamp)
Get the list of id of users that have an expired time life but not the expired status
|
List<Integer> |
getIdUsersWithExpiredPasswordsList(Timestamp currentTimestamp)
Get the list of id of users that have an expired password but not the change password flag
|
boolean |
hasRight(int nUserId,
String strIdRight)
Check if the user has the given right
|
boolean |
hasRole(int nUserId,
String strRoleKey)
Check if the user has the role
|
void |
insert(AdminUser user)
Insert a new record in the table.
|
void |
insert(LuteceDefaultAdminUser user)
Insert a new record in the table.
|
void |
insertNewPasswordInHistory(IPassword password,
int nUserId)
Log a password change in the password history
|
void |
insertRightsListForUser(int nUserId,
String strRightId)
Add a right to an user
|
void |
insertRolesListForUser(int nUserId,
String strRoleKey)
Gives a role to an user
|
AdminUser |
load(int nUserId)
Load an AdminUser
|
LuteceDefaultAdminUser |
loadDefaultAdminUser(int nUserId)
Load a default AdminUser
|
void |
removeAllPasswordHistoryForUser(int nUserId)
Remove every password saved in the password history for a given user.
|
Map<String,Boolean> |
selectAnonymizationStatusUserStaticField()
Get a map of anonymization status of a user field.
|
Map<String,Right> |
selectRightsListForUser(int nUserId)
Get the right list associated to a given user id
|
Map<String,AdminRole> |
selectRolesListForUser(int nUserId)
Get the role list associated to a given user id
|
AdminUser |
selectUserByAccessCode(String strUserAccessCode)
Get an user by its access code (login)
|
String |
selectUserByEmail(String strEmail)
Get the user access code from its email.
|
Collection<AdminUser> |
selectUserList()
Gets the collection of all AdminUsers
|
List<IPassword> |
selectUserPasswordHistory(int nUserID)
Gets the history of password of the given user
|
Collection<AdminUser> |
selectUsersByFilter(AdminUserFilter auFilter)
Select users by filter
|
Collection<AdminUser> |
selectUsersByLevel(int nIdLevel)
Select all user that own a given level
|
Collection<AdminUser> |
selectUsersByRight(String strIdRight)
Get all users having a given right
|
Collection<AdminUser> |
selectUsersByRole(String strRoleKey)
Gets a collection of AdminUser that share a given role
|
void |
store(AdminUser user)
Update AdminUser data
|
void |
store(LuteceDefaultAdminUser user,
PasswordUpdateMode passwordMode)
Update AdminUser data
|
void |
storeUsersRole(String strOldRoleKey,
AdminRole role)
Update role key if role key name has change
|
void |
updateAnonymizationStatusUserStaticField(String strFieldName,
boolean bAnonymizeFiled)
Update the anonymization status of a user field.
|
void |
updateChangePassword(List<Integer> listIdUser)
Set the "change password" flag of users to true
|
void |
updateDateLastLogin(int nIdUser,
Timestamp dateLastLogin)
Update the admin user last login date.
|
void |
updateNbAlert(List<Integer> listIdUser)
Increment the number of alert send to users by 1
|
void |
updateUserExpirationDate(int nIdUser,
Timestamp newExpirationDate)
Update the admin user expiration date with the new values.
|
void |
updateUserStatus(List<Integer> listIdUser,
int nNewStatus)
Update status of a list of user accounts
|
public AdminUser load(int nUserId)
load
in interface IAdminUserDAO
nUserId
- the user idpublic AdminUser selectUserByAccessCode(String strUserAccessCode)
selectUserByAccessCode
in interface IAdminUserDAO
strUserAccessCode
- the loginpublic String selectUserByEmail(String strEmail)
selectUserByEmail
in interface IAdminUserDAO
strEmail
- The emailpublic Collection<AdminUser> selectUserList()
selectUserList
in interface IAdminUserDAO
public void insert(AdminUser user)
insert
in interface IAdminUserDAO
user
- The AdminUserpublic void store(AdminUser user)
store
in interface IAdminUserDAO
user
- The AdminUserpublic void delete(int nUserId)
delete
in interface IAdminUserDAO
nUserId
- the user idpublic Map<String,Right> selectRightsListForUser(int nUserId)
selectRightsListForUser
in interface IAdminUserDAO
nUserId
- the id of the user to retrieve rightspublic void insertRightsListForUser(int nUserId, String strRightId)
insertRightsListForUser
in interface IAdminUserDAO
nUserId
- the user idstrRightId
- the right idpublic void deleteAllRightsForUser(int nUserId)
deleteAllRightsForUser
in interface IAdminUserDAO
nUserId
- the user idpublic Map<String,AdminRole> selectRolesListForUser(int nUserId)
selectRolesListForUser
in interface IAdminUserDAO
nUserId
- the id of the user to retrieve rolespublic void insertRolesListForUser(int nUserId, String strRoleKey)
insertRolesListForUser
in interface IAdminUserDAO
nUserId
- the user idstrRoleKey
- the key rolepublic void deleteAllRolesForUser(int nUserId)
deleteAllRolesForUser
in interface IAdminUserDAO
nUserId
- the user idpublic boolean checkRoleAttributed(String strRoleKey)
checkRoleAttributed
in interface IAdminUserDAO
strRoleKey
- the role key to checkpublic int checkAccessCodeAlreadyInUse(String strAccessCode)
checkAccessCodeAlreadyInUse
in interface IAdminUserDAO
strAccessCode
- The access codepublic int checkEmailAlreadyInUse(String strEmail)
checkEmailAlreadyInUse
in interface IAdminUserDAO
strEmail
- The emailpublic void insert(LuteceDefaultAdminUser user)
insert
in interface IAdminUserDAO
user
- The AdminUserpublic void store(LuteceDefaultAdminUser user, PasswordUpdateMode passwordMode)
store
in interface IAdminUserDAO
user
- The AdminUserpasswordMode
- Should the password be updated or notpublic LuteceDefaultAdminUser loadDefaultAdminUser(int nUserId)
loadDefaultAdminUser
in interface IAdminUserDAO
nUserId
- the user idpublic Collection<AdminUser> selectUsersByRole(String strRoleKey)
selectUsersByRole
in interface IAdminUserDAO
strRoleKey
- The role keypublic Collection<AdminUser> selectUsersByLevel(int nIdLevel)
selectUsersByLevel
in interface IAdminUserDAO
nIdLevel
- The levelpublic void deleteAllOwnRightsForUser(int nUserId, int nUserLevel)
deleteAllOwnRightsForUser
in interface IAdminUserDAO
nUserId
- the user idnUserLevel
- the user levelpublic void deleteAllDelegatedRightsForUser(int nUserId, int nUserLevel)
deleteAllDelegatedRightsForUser
in interface IAdminUserDAO
nUserId
- the user idnUserLevel
- the user levelpublic void storeUsersRole(String strOldRoleKey, AdminRole role)
storeUsersRole
in interface IAdminUserDAO
strOldRoleKey
- The old role key namerole
- The new rolepublic boolean hasRole(int nUserId, String strRoleKey)
hasRole
in interface IAdminUserDAO
nUserId
- The ID of the userstrRoleKey
- The role Keypublic void deleteRoleForUser(int nUserId, String strRoleKey)
deleteRoleForUser
in interface IAdminUserDAO
nUserId
- The ID of the userstrRoleKey
- The role keypublic Collection<AdminUser> selectUsersByFilter(AdminUserFilter auFilter)
selectUsersByFilter
in interface IAdminUserDAO
auFilter
- the filterpublic Collection<AdminUser> selectUsersByRight(String strIdRight)
selectUsersByRight
in interface IAdminUserDAO
strIdRight
- The ID rightpublic boolean hasRight(int nUserId, String strIdRight)
hasRight
in interface IAdminUserDAO
nUserId
- The ID of the userstrIdRight
- The ID rightpublic void deleteRightForUser(int nUserId, String strIdRight)
deleteRightForUser
in interface IAdminUserDAO
nUserId
- The user IDstrIdRight
- The right IDpublic List<IPassword> selectUserPasswordHistory(int nUserID)
selectUserPasswordHistory
in interface IAdminUserDAO
nUserID
- Id of the userpublic int countUserPasswordHistoryFromDate(Timestamp minDate, int nUserId)
countUserPasswordHistoryFromDate
in interface IAdminUserDAO
minDate
- Minimum date to consider.nUserId
- Id of the userpublic void insertNewPasswordInHistory(IPassword password, int nUserId)
insertNewPasswordInHistory
in interface IAdminUserDAO
password
- New password of the usernUserId
- Id of the userpublic void removeAllPasswordHistoryForUser(int nUserId)
removeAllPasswordHistoryForUser
in interface IAdminUserDAO
nUserId
- Id of the userpublic Map<String,Boolean> selectAnonymizationStatusUserStaticField()
selectAnonymizationStatusUserStaticField
in interface IAdminUserDAO
public void updateAnonymizationStatusUserStaticField(String strFieldName, boolean bAnonymizeFiled)
updateAnonymizationStatusUserStaticField
in interface IAdminUserDAO
strFieldName
- Name of the field to updatebAnonymizeFiled
- True if the field should be anonymized, false otherwisepublic List<Integer> findAllExpiredUserId()
findAllExpiredUserId
in interface IAdminUserDAO
public List<Integer> getIdUsersWithExpiredLifeTimeList(Timestamp currentTimestamp)
getIdUsersWithExpiredLifeTimeList
in interface IAdminUserDAO
currentTimestamp
- Timestamp describing the current time.public List<Integer> getIdUsersToSendFirstAlert(Timestamp alertMaxDate)
getIdUsersToSendFirstAlert
in interface IAdminUserDAO
alertMaxDate
- The maximum date to send alerts.public List<Integer> getIdUsersToSendOtherAlert(Timestamp alertMaxDate, Timestamp timeBetweenAlerts, int maxNumberAlerts)
getIdUsersToSendOtherAlert
in interface IAdminUserDAO
alertMaxDate
- The maximum date to send alerts.timeBetweenAlerts
- Timestamp describing the time between two alerts.maxNumberAlerts
- Maximum number of alerts to send to a userpublic List<Integer> getIdUsersWithExpiredPasswordsList(Timestamp currentTimestamp)
getIdUsersWithExpiredPasswordsList
in interface IAdminUserDAO
currentTimestamp
- Timestamp describing the current time.public void updateUserStatus(List<Integer> listIdUser, int nNewStatus)
updateUserStatus
in interface IAdminUserDAO
listIdUser
- List of user accounts to updatenNewStatus
- New status of the userpublic void updateNbAlert(List<Integer> listIdUser)
updateNbAlert
in interface IAdminUserDAO
listIdUser
- The list of users to updatepublic void updateChangePassword(List<Integer> listIdUser)
updateChangePassword
in interface IAdminUserDAO
listIdUser
- The list of users to updatepublic void updateUserExpirationDate(int nIdUser, Timestamp newExpirationDate)
updateUserExpirationDate
in interface IAdminUserDAO
nIdUser
- Id of the admin user to updatenewExpirationDate
- New expiration date of the userpublic void updateDateLastLogin(int nIdUser, Timestamp dateLastLogin)
updateDateLastLogin
in interface IAdminUserDAO
nIdUser
- Id of the admin user to updatedateLastLogin
- New last login date of the userCopyright © 2020 City of Paris. All rights reserved.