Class DatabaseService
java.lang.Object
fr.paris.lutece.plugins.mylutece.modules.database.authentication.service.DatabaseService
@ApplicationScoped
@Named("mylutece-database.databaseService")
public class DatabaseService
extends Object
DatabaseService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeUserPasswordAndNotify(String strBaseURL, fr.paris.lutece.portal.service.plugin.Plugin plugin, Locale locale) Change all user's password and notify them with an email.booleancheckPassword(String strUserGuid, String strPassword, fr.paris.lutece.portal.service.plugin.Plugin plugin) Check the passwordvoiddoAutoLoginDatabaseUser(jakarta.servlet.http.HttpServletRequest request, DatabaseUser databaseUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Login automatically the database userdoCreateUser(DatabaseUser user, String strPassword, fr.paris.lutece.portal.service.plugin.Plugin plugin) Do create a new database uservoiddoInsertNewPasswordInHistory(String strPassword, int nUserId, fr.paris.lutece.portal.service.plugin.Plugin plugin) Log a password change in the password historyvoiddoModifyPassword(DatabaseUser user, String strPassword, fr.paris.lutece.portal.service.plugin.Plugin plugin) Do modify the passwordvoiddoModifyResetPassword(DatabaseUser user, boolean bNewValue, fr.paris.lutece.portal.service.plugin.Plugin plugin) Do modify the reset password attributevoiddoUpdateUser(DatabaseUser user, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update the info of the usergetAuthorizedUsers(fr.paris.lutece.portal.business.user.AdminUser adminUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get authorized users listgetExportUser(DatabaseUser user, boolean bExportRoles, boolean bExportGroups, boolean bExportAttributes, List<fr.paris.lutece.plugins.mylutece.business.attribute.IAttribute> listAttributes) Get a DatabaseUserWrapper describing a given user for exportgetFilteredUsersInterface(DatabaseUserFilter duFilter, boolean bIsSearch, List<DatabaseUser> listUsers, jakarta.servlet.http.HttpServletRequest request, Map<String, Object> model, fr.paris.lutece.util.url.UrlItem url) Get the filtered list of database usersgetListFilteredUsers(jakarta.servlet.http.HttpServletRequest request, DatabaseUserFilter duFilter, List<DatabaseUser> listUsers) Get th list of filteredUsersgetManageAdvancedParameters(fr.paris.lutece.portal.business.user.AdminUser user) Build the advanced parameters managementstatic DatabaseServiceDeprecated.voidinit()Initialize the Database servicebooleanisAuthorized(DatabaseUser user, fr.paris.lutece.portal.business.user.AdminUser adminUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Check if an Lutece user should be visible to the user according its workgroupbooleanCheck if the plugin jcaptcha is activated or notbooleanisUserActive(String strUserName, fr.paris.lutece.portal.service.plugin.Plugin plugin) Check if the user is active or notbooleanmustUserChangePassword(fr.paris.lutece.portal.service.security.LuteceUser databaseUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Check whether a user must change his passwordvoidupdateUserExpirationDate(int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update the user expiration date with new values, and notify him with an email.voidupdateUserLastLoginDate(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update a user last login date.
-
Constructor Details
-
DatabaseService
public DatabaseService()
-
-
Method Details
-
init
@PostConstruct public void init()Initialize the Database service -
getService
Deprecated.Returns the instance of the singleton- Returns:
- The instance of the singleton
-
getManageAdvancedParameters
public Map<String,Object> getManageAdvancedParameters(fr.paris.lutece.portal.business.user.AdminUser user) Build the advanced parameters management- Parameters:
user- the admin user- Returns:
- The model for the advanced parameters
-
isAuthorized
public boolean isAuthorized(DatabaseUser user, fr.paris.lutece.portal.business.user.AdminUser adminUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Check if an Lutece user should be visible to the user according its workgroup- Parameters:
user- the Lutece useradminUser- the admin userplugin- the plugin- Returns:
- true if the Lutece user should be visible, false otherwise
-
getAuthorizedUsers
public List<DatabaseUser> getAuthorizedUsers(fr.paris.lutece.portal.business.user.AdminUser adminUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get authorized users list- Parameters:
adminUser- the admin userplugin- the plugin- Returns:
- a list of users
-
getFilteredUsersInterface
public List<DatabaseUser> getFilteredUsersInterface(DatabaseUserFilter duFilter, boolean bIsSearch, List<DatabaseUser> listUsers, jakarta.servlet.http.HttpServletRequest request, Map<String, Object> model, fr.paris.lutece.util.url.UrlItem url) Get the filtered list of database users- Parameters:
duFilter- The filterbIsSearch- True if the user used search filters, false otherwiselistUsers- the initial list to filterrequest- HttpServletRequestmodel- Mapurl- UrlItem- Returns:
- the filtered list
-
getListFilteredUsers
public List<DatabaseUser> getListFilteredUsers(jakarta.servlet.http.HttpServletRequest request, DatabaseUserFilter duFilter, List<DatabaseUser> listUsers) Get th list of filteredUsers- Parameters:
request- the HTTP requestduFilter- the filterlistUsers- the list of users- Returns:
- a list of
DatabaseUser
-
doCreateUser
public DatabaseUser doCreateUser(DatabaseUser user, String strPassword, fr.paris.lutece.portal.service.plugin.Plugin plugin) Do create a new database user- Parameters:
user- the userstrPassword- the passwordplugin- the plugin- Returns:
- the new database user with a new ID
-
doModifyPassword
public void doModifyPassword(DatabaseUser user, String strPassword, fr.paris.lutece.portal.service.plugin.Plugin plugin) Do modify the password- Parameters:
user- the DatabaseUserstrPassword- the new password not encryptedplugin- the plugin
-
doModifyResetPassword
public void doModifyResetPassword(DatabaseUser user, boolean bNewValue, fr.paris.lutece.portal.service.plugin.Plugin plugin) Do modify the reset password attribute- Parameters:
user- the DatabaseUserbNewValue- the new valueplugin- the plugin
-
doUpdateUser
Update the info of the user- Parameters:
user- the userplugin- the plugin
-
checkPassword
public boolean checkPassword(String strUserGuid, String strPassword, fr.paris.lutece.portal.service.plugin.Plugin plugin) Check the password- Parameters:
strUserGuid- the user guidstrPassword- the passwordplugin- the plugin- Returns:
- true if the password is the same as stored in the database, false otherwise
-
isUserActive
public boolean isUserActive(String strUserName, fr.paris.lutece.portal.service.plugin.Plugin plugin) Check if the user is active or not- Parameters:
strUserName- the user nameplugin- the plugin- Returns:
- true if it is active, false otherwise
-
isPluginJcaptchaEnable
public boolean isPluginJcaptchaEnable()Check if the plugin jcaptcha is activated or not- Returns:
- true if it is activated, false otherwise
-
changeUserPasswordAndNotify
public void changeUserPasswordAndNotify(String strBaseURL, fr.paris.lutece.portal.service.plugin.Plugin plugin, Locale locale) Change all user's password and notify them with an email.- Parameters:
strBaseURL- The base url of the applicationplugin- The pluginlocale- The locale to use
-
mustUserChangePassword
public boolean mustUserChangePassword(fr.paris.lutece.portal.service.security.LuteceUser databaseUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Check whether a user must change his password- Parameters:
databaseUser- The user to checkplugin- The plugin- Returns:
- True if a user must change his password, false otherwise.
-
doInsertNewPasswordInHistory
public void doInsertNewPasswordInHistory(String strPassword, 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
-
updateUserExpirationDate
public void updateUserExpirationDate(int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update the user expiration date with new values, and notify him with an email.- Parameters:
nIdUser- Id of the user to updateplugin- The plugin
-
updateUserLastLoginDate
public void updateUserLastLoginDate(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update a user last login date.- Parameters:
strLogin- Login of the user to updateplugin- The plugin
-
getExportUser
public DatabaseUserWrapper getExportUser(DatabaseUser user, boolean bExportRoles, boolean bExportGroups, boolean bExportAttributes, List<fr.paris.lutece.plugins.mylutece.business.attribute.IAttribute> listAttributes) Get a DatabaseUserWrapper describing a given user for export- Parameters:
user- The user.bExportRoles- True to export roles of the user, false otherwise.bExportGroups- True to export groups of the user, false otherwise.bExportAttributes- True to export attributes of the user, false otherwise.listAttributes- The list of attributes to export.- Returns:
- DatabaseUserWrapper databaseUserWrapper
-
doAutoLoginDatabaseUser
public void doAutoLoginDatabaseUser(jakarta.servlet.http.HttpServletRequest request, DatabaseUser databaseUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Login automatically the database user- Parameters:
request- the HTTP requestDatabaseUser- databaseUserplugin- the plugin
-