public final class AdminUserService extends Object
Modifier and Type | Method and Description |
---|---|
static void |
anonymizeUser(int nAdminUserId,
Locale locale)
Anonymize user data from his id.
|
static boolean |
checkEmail(String strEmail)
Check if the given email is valid or not.
|
static String |
checkPassword(javax.servlet.http.HttpServletRequest request,
String strPassword,
int nUserId)
Check that the password respect user parameters
|
static String |
checkPassword(javax.servlet.http.HttpServletRequest request,
String strPassword,
int nUserId,
boolean bSkipHistoryCheck)
Check that the password respect user parameters
|
static void |
doInsertRegularExpression(int nRegularExpressionId)
Do insert a regular expression
|
static void |
doModifyEmailPattern(String strEmailPattern,
boolean bIsSetManually)
Do modify the email pattern
|
static void |
doRemoveRegularExpression(int nRegularExpressionId)
Do remove a regular expression
|
static void |
doResetEmailPattern()
Reset the email pattern by putting the default email pattern that is set in the lutece.properties.
|
static IPassword |
encryptPassword(String strPassword)
Encrypt a password
|
static Timestamp |
getAccountMaxValidDate()
Compute the maximum valid date of an account with the current time and the parameters in the database.
|
static AdminUser |
getAdminUser(javax.servlet.http.HttpServletRequest request)
Get the user in session
|
static ReferenceList |
getAvailableRegularExpressions()
Get the available rugalar expressions
|
static boolean |
getBooleanSecurityParameter(String strParameterkey)
Get a boolean user parameter from its key.
|
static String |
getEmailErrorMessageUrl(javax.servlet.http.HttpServletRequest request)
Get the email error message url.
|
static List<Integer> |
getExpiredUserIdList()
Get the list of id of expired users
|
static List<AdminUser> |
getFilteredUsersInterface(Collection<AdminUser> listUsers,
javax.servlet.http.HttpServletRequest request,
Map<String,Object> model,
UrlItem url)
Get the filtered list of admin users
|
static int |
getIntegerSecurityParameter(String strParameterkey)
Get an integer user parameter from its key.
|
static String |
getLargeSecurityParameter(String strParameterKey)
Get a user parameter from its key.
|
static Locale |
getLocale(javax.servlet.http.HttpServletRequest request)
Get the locale for the current request
|
static Map<String,Object> |
getManageAdvancedParameters(AdminUser user)
Build the advanced parameters management
|
static Timestamp |
getPasswordMaxValidDate()
Compute the maximum valid date of a password with the current time and the parameters in the database.
|
static String |
getSecurityParameter(String strParameterkey)
Get a user parameter from its key.
|
static List<RegularExpression> |
getSelectedRegularExpressions()
Get the list of selected regular expression
|
static String |
getUserPasswordResetToken(AdminUser user,
Date timestamp,
javax.servlet.http.HttpServletRequest request)
Get a user reset password token
|
static String |
getXmlFromUser(AdminUser user,
boolean bIncludeRoles,
boolean bIncludeRights,
boolean bIncludeWorkgroups,
boolean bIncludeAttributes,
List<IAttribute> listAttributes)
Get a XML string describing a user.
The XML is constructed as follow : <user> <access_code>value</value> <last_name>value>/user> <first_name>value</value> <email>value</email> <status>value</status> <locale>value</locale> <level>value</level> <must_change_password>value< must_change_password> <accessibility_mode>value< accessibility_mode> <password_max_valid_date>value< password_max_valid_date> <account_max_valid_date>value< account_max_valid_date> <date_last_login>value</date_last_login> <roles> <role>value</role> ... </roles> <rights> <right>value</right> ... </rights> <workspaces> <workspace>value</workspace> ... </workspaces> <attributes> <attribute> <attribute-id>value</attribute-id> <attribute-field-id> value</attribute-id> <attribute-value>value</attribute-value> </attribute> ... </attributes> </user> Sections roles, rights, workspaces and attributes are not included if data are not imported |
static void |
init()
Init
|
static String |
makePassword()
Generate a new random password
|
static void |
notifyUser(String strBaseUrl,
AdminUser user,
String strPropertyEmailSubject,
String strTemplate)
Notify an user by email
|
static void |
notifyUser(String strBaseUrl,
AdminUser user,
String strPassword,
String strPropertyEmailSubject,
String strTemplate)
Notify an user by email
|
static void |
removeAdvancedSecurityParameters()
Disable advances security parameters
|
static void |
updateDateLastLogin(int nIdUser)
Update the date of last login of an admin user
|
static void |
updateLargeSecurityParameter(String strParameterKey,
String strValue)
Update a security parameter value.
|
static void |
updateSecurityParameter(String strParameterKey,
String strValue)
Update a security parameter value.
|
static void |
updateUserExpirationDate(AdminUser user)
Update the user expiration date with new values, and notify him with an email if his account was close to expire.
|
static void |
useAdvancedSecurityParameters()
Enable advanced security parameters
|
public static final String DSKEY_ACCOUNT_REACTIVATED_MAIL_SENDER
public static final String DSKEY_ACCOUNT_REACTIVATED_MAIL_SUBJECT
public static final String DSKEY_ACCOUNT_REACTIVATED_MAIL_BODY
public static final String DSKEY_PASSWORD_DURATION
public static final String DSKEY_MAXIMUM_NUMBER_PASSWORD_CHANGE
public static final String DSKEY_PASSWORD_HISTORY_SIZE
public static final String DSKEY_TSW_SIZE_PASSWORD_CHANGE
public static final String DSKEY_NOTIFY_USER_PASSWORD_EXPIRED
public static final String DSKEY_BANNED_DOMAIN_NAMES
public static final String DSKEY_ACCOUNT_LIFE_TIME
public static final String DSKEY_TIME_BEFORE_ALERT_ACCOUNT
public static final String DSKEY_NB_ALERT_ACCOUNT
public static final String DSKEY_TIME_BETWEEN_ALERTS_ACCOUNT
public static final String DSKEY_ACCES_FAILURES_MAX
public static final String DSKEY_ACCES_FAILURES_INTERVAL
public static final String DSKEY_EMAIL_PATTERN
public static final String DSKEY_EMAIL_PATTERN_VERIFY_BY
public static final String DSKEY_PASSWORD_FORMAT_SPECIAL_CHARACTERS
public static final String DSKEY_PASSWORD_FORMAT_NUMERO
public static final String DSKEY_PASSWORD_FORMAT_UPPER_LOWER_CASE
public static final String DSKEY_FORCE_CHANGE_PASSWORD_REINIT
public static final String DSKEY_PASSWORD_MINIMUM_LENGTH
public static final String DSKEY_DEFAULT_USER_STATUS
public static final String DSKEY_DEFAULT_USER_LANGUAGE
public static final String DSKEY_DEFAULT_USER_NOTIFICATION
public static final String DSKEY_DEFAULT_USER_LEVEL
public static final String DSKEY_USE_ADVANCED_SECURITY_PARAMETERS
public static final String DSKEY_RESET_TOKEN_VALIDITY
public static final String DSKEY_LOCK_RESET_TOKEN_TO_SESSION
public static void init()
public static AdminUser getAdminUser(javax.servlet.http.HttpServletRequest request)
request
- The HTTP requestpublic static Locale getLocale(javax.servlet.http.HttpServletRequest request)
request
- The HTTP requestpublic static List<AdminUser> getFilteredUsersInterface(Collection<AdminUser> listUsers, javax.servlet.http.HttpServletRequest request, Map<String,Object> model, UrlItem url)
listUsers
- the initial list of usersrequest
- HttpServletRequestmodel
- mapurl
- URL of the current interfacepublic static Map<String,Object> getManageAdvancedParameters(AdminUser user)
user
- The AdminUser objectpublic static boolean checkEmail(String strEmail)
strEmail
- the str emailpublic static void doModifyEmailPattern(String strEmailPattern, boolean bIsSetManually)
strEmailPattern
- the email patternbIsSetManually
- true if it is know set manually, false otherwisepublic static void doResetEmailPattern()
public static String getEmailErrorMessageUrl(javax.servlet.http.HttpServletRequest request)
request
- the requestpublic static void doInsertRegularExpression(int nRegularExpressionId)
nRegularExpressionId
- the ID of the regular expressionpublic static void doRemoveRegularExpression(int nRegularExpressionId)
nRegularExpressionId
- the ID of the regularexpresionpublic static ReferenceList getAvailableRegularExpressions()
ReferenceList
public static List<RegularExpression> getSelectedRegularExpressions()
RegularExpression
public static int getIntegerSecurityParameter(String strParameterkey)
strParameterkey
- Key of the parameterpublic static boolean getBooleanSecurityParameter(String strParameterkey)
strParameterkey
- Key of the parameterpublic static String getSecurityParameter(String strParameterkey)
strParameterkey
- Key of the parameterpublic static String getLargeSecurityParameter(String strParameterKey)
strParameterKey
- Key of the parameterpublic static void updateSecurityParameter(String strParameterKey, String strValue)
strParameterKey
- The key of the parameterstrValue
- The new valuepublic static void updateLargeSecurityParameter(String strParameterKey, String strValue)
strParameterKey
- The key of the parameterstrValue
- The new valuepublic static String checkPassword(javax.servlet.http.HttpServletRequest request, String strPassword, int nUserId)
request
- The requeststrPassword
- The password to checknUserId
- The id of the modified userpublic static String checkPassword(javax.servlet.http.HttpServletRequest request, String strPassword, int nUserId, boolean bSkipHistoryCheck)
request
- The requeststrPassword
- The password to checknUserId
- The id of the modified userbSkipHistoryCheck
- Indicates if the password history should be checked or not.public static String makePassword()
public static IPassword encryptPassword(String strPassword)
strPassword
- The password to encryptpublic static void useAdvancedSecurityParameters()
public static void removeAdvancedSecurityParameters()
public static Timestamp getPasswordMaxValidDate()
public static Timestamp getAccountMaxValidDate()
public static void anonymizeUser(int nAdminUserId, Locale locale)
nAdminUserId
- Id of the user to anonymizelocale
- The localepublic static List<Integer> getExpiredUserIdList()
public static void updateUserExpirationDate(AdminUser user)
user
- The user to updatepublic static void updateDateLastLogin(int nIdUser)
nIdUser
- Id of the user to updatepublic static void notifyUser(String strBaseUrl, AdminUser user, String strPropertyEmailSubject, String strTemplate)
strBaseUrl
- The base URL of the webappuser
- The admin user to notifystrPropertyEmailSubject
- the property of the subject emailstrTemplate
- the URL of the HTML Templatepublic static void notifyUser(String strBaseUrl, AdminUser user, String strPassword, String strPropertyEmailSubject, String strTemplate)
strBaseUrl
- The base URL of the webappuser
- The admin user to notifystrPassword
- the user password in cleartextstrPropertyEmailSubject
- the property of the subject emailstrTemplate
- the URL of the HTML Templatepublic static String getXmlFromUser(AdminUser user, boolean bIncludeRoles, boolean bIncludeRights, boolean bIncludeWorkgroups, boolean bIncludeAttributes, List<IAttribute> listAttributes)
user
- The user to get the XML description of.bIncludeRoles
- True to include roles of the user in the XML, false otherwise.bIncludeRights
- True to include rights of the user in the XML, false otherwise.bIncludeWorkgroups
- True to include workgroups of the user in the XML, false otherwise.bIncludeAttributes
- True to include attributes of the user in the XML, false otherwise.listAttributes
- The list of attributes to include in the XML if attributes are included.public static String getUserPasswordResetToken(AdminUser user, Date timestamp, javax.servlet.http.HttpServletRequest request)
user
- the usertimestamp
- the timestamp of the tokenrequest
- he requestCopyright © 2020 City of Paris. All rights reserved.