Class DatabaseDAO
java.lang.Object
fr.paris.lutece.plugins.mylutece.modules.database.authentication.business.DatabaseDAO
- All Implemented Interfaces:
IDatabaseDAO
@ApplicationScoped
@Named("mylutece-database.databaseDAO")
public class DatabaseDAO
extends Object
implements IDatabaseDAO
This class provides Data Access methods for authentication (role retrieval).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateGroupForUser(int nIdUser, String strGroupKey, fr.paris.lutece.portal.service.plugin.Plugin plugin) Assign a group to uservoidcreateRoleForUser(int nIdUser, String strRoleKey, fr.paris.lutece.portal.service.plugin.Plugin plugin) Assign a role to uservoiddeleteGroupsForUser(int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Delete groups for a uservoiddeleteRolesForUser(int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Delete roles for a userintfindUserIdFromLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get the id of a user from his loginselectGroupUsersFromGroupKey(String strGroupKey, fr.paris.lutece.portal.service.plugin.Plugin plugin) Find assigned users to the given groupselectLoginListForRoleKey(String strRoleKey, fr.paris.lutece.portal.service.plugin.Plugin plugin) Load the list of DatabaseUsers for a Lutece roleselectLuteceUserByLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin, fr.paris.lutece.portal.service.security.LuteceAuthentication authenticationService) Find DatabaseUser by loginselectLuteceUserList(fr.paris.lutece.portal.service.plugin.Plugin plugin, fr.paris.lutece.portal.service.security.LuteceAuthentication authenticationService) Load the list ofBaseUserselectPasswordMaxValideDateFromLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Gets the password max valid date of a user from his login.booleanselectResetPasswordFromLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Check if a user has reset his password from his loginselectUserGroupsFromLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Find user's groups by loginselectUserRolesFromLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Find user's roles by loginvoidupdateResetPasswordFromLogin(String strUserName, boolean bNewValue, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update the reset password attribut of a user from his login
-
Constructor Details
-
DatabaseDAO
public DatabaseDAO()
-
-
Method Details
-
selectLuteceUserByLogin
public BaseUser selectLuteceUserByLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin, fr.paris.lutece.portal.service.security.LuteceAuthentication authenticationService) Find DatabaseUser by login- Specified by:
selectLuteceUserByLoginin interfaceIDatabaseDAO- Parameters:
strLogin- the loginplugin- The Plugin using this data access serviceauthenticationService- the LuteceAuthentication object- Returns:
- DatabaseUser the user corresponding to the login
-
selectResetPasswordFromLogin
public boolean selectResetPasswordFromLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Check if a user has reset his password from his login- Specified by:
selectResetPasswordFromLoginin interfaceIDatabaseDAO- Parameters:
strLogin- the loginplugin- The Plugin using this data access service- Returns:
- boolean true if the password vhas been reset, false otherwise
-
selectPasswordMaxValideDateFromLogin
public Timestamp selectPasswordMaxValideDateFromLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Gets the password max valid date of a user from his login.- Specified by:
selectPasswordMaxValideDateFromLoginin interfaceIDatabaseDAO- Parameters:
strLogin- the login of the userplugin- The plugin- Returns:
- The date of end of validity of the password of the user, or null if none has been set.
-
selectLuteceUserList
public Collection<BaseUser> selectLuteceUserList(fr.paris.lutece.portal.service.plugin.Plugin plugin, fr.paris.lutece.portal.service.security.LuteceAuthentication authenticationService) Load the list ofBaseUser- Specified by:
selectLuteceUserListin interfaceIDatabaseDAO- Parameters:
plugin- The Plugin using this data access serviceauthenticationService- the authentication service- Returns:
- The Collection of the
BaseUser
-
selectUserRolesFromLogin
public List<String> selectUserRolesFromLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Find user's roles by login- Specified by:
selectUserRolesFromLoginin interfaceIDatabaseDAO- Parameters:
strLogin- the loginplugin- The Plugin using this data access service- Returns:
- ArrayList the roles key list corresponding to the login
-
deleteRolesForUser
public void deleteRolesForUser(int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Delete roles for a user- Specified by:
deleteRolesForUserin interfaceIDatabaseDAO- Parameters:
nIdUser- The id of the userplugin- The Plugin using this data access service
-
createRoleForUser
public void createRoleForUser(int nIdUser, String strRoleKey, fr.paris.lutece.portal.service.plugin.Plugin plugin) Assign a role to user- Specified by:
createRoleForUserin interfaceIDatabaseDAO- Parameters:
nIdUser- The id of the userstrRoleKey- The key of the roleplugin- The Plugin using this data access service
-
selectUserGroupsFromLogin
public List<String> selectUserGroupsFromLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Find user's groups by login- Specified by:
selectUserGroupsFromLoginin interfaceIDatabaseDAO- Parameters:
strLogin- The loginplugin- The Plugin using this data access service- Returns:
- ArrayList the group key list corresponding to the login
-
selectLoginListForRoleKey
public Collection<String> selectLoginListForRoleKey(String strRoleKey, fr.paris.lutece.portal.service.plugin.Plugin plugin) Load the list of DatabaseUsers for a Lutece role- Specified by:
selectLoginListForRoleKeyin interfaceIDatabaseDAO- Parameters:
strRoleKey- The role key of DatabaseUserplugin- The Plugin using this data access service- Returns:
- The Collection of the DatabaseUsers
-
deleteGroupsForUser
public void deleteGroupsForUser(int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin) Delete groups for a user- Specified by:
deleteGroupsForUserin interfaceIDatabaseDAO- Parameters:
nIdUser- The id of the userplugin- The Plugin using this data access service
-
createGroupForUser
public void createGroupForUser(int nIdUser, String strGroupKey, fr.paris.lutece.portal.service.plugin.Plugin plugin) Assign a group to user- Specified by:
createGroupForUserin interfaceIDatabaseDAO- Parameters:
nIdUser- The id of the userstrGroupKey- The key of the groupplugin- The Plugin using this data access service
-
selectGroupUsersFromGroupKey
public List<DatabaseUser> selectGroupUsersFromGroupKey(String strGroupKey, fr.paris.lutece.portal.service.plugin.Plugin plugin) Find assigned users to the given group- Specified by:
selectGroupUsersFromGroupKeyin interfaceIDatabaseDAO- Parameters:
strGroupKey- The group keyplugin- Plugin- Returns:
- a list of DatabaseUser
-
updateResetPasswordFromLogin
public void updateResetPasswordFromLogin(String strUserName, boolean bNewValue, fr.paris.lutece.portal.service.plugin.Plugin plugin) Update the reset password attribut of a user from his login- Specified by:
updateResetPasswordFromLoginin interfaceIDatabaseDAO- Parameters:
strUserName- Login of the user to updatebNewValue- New valueplugin- The plugin
-
findUserIdFromLogin
public int findUserIdFromLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin) Get the id of a user from his login- Specified by:
findUserIdFromLoginin interfaceIDatabaseDAO- Parameters:
strLogin- Login of the userplugin- The plugin- Returns:
- The id of the user
-