Class DatabaseDAO

  • All Implemented Interfaces:
    IDatabaseDAO

    public class DatabaseDAO
    extends java.lang.Object
    implements IDatabaseDAO
    This class provides Data Access methods for authentication (role retrieval).
    • Constructor Summary

      Constructors 
      Constructor Description
      DatabaseDAO()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void createGroupForUser​(int nIdUser, java.lang.String strGroupKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Assign a group to user
      void createRoleForUser​(int nIdUser, java.lang.String strRoleKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Assign a role to user
      void deleteGroupsForUser​(int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Delete groups for a user
      void deleteRolesForUser​(int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Delete roles for a user
      int findUserIdFromLogin​(java.lang.String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Get the id of a user from his login
      java.util.List<DatabaseUser> selectGroupUsersFromGroupKey​(java.lang.String strGroupKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Find assigned users to the given group
      java.util.Collection<java.lang.String> selectLoginListForRoleKey​(java.lang.String strRoleKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Load the list of DatabaseUsers for a Lutece role
      BaseUser selectLuteceUserByLogin​(java.lang.String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin, fr.paris.lutece.portal.service.security.LuteceAuthentication authenticationService)
      Find DatabaseUser by login
      java.util.Collection<BaseUser> selectLuteceUserList​(fr.paris.lutece.portal.service.plugin.Plugin plugin, fr.paris.lutece.portal.service.security.LuteceAuthentication authenticationService)
      Load the list of BaseUser
      java.sql.Timestamp selectPasswordMaxValideDateFromLogin​(java.lang.String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Gets the password max valid date of a user from his login.
      boolean selectResetPasswordFromLogin​(java.lang.String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Check if a user has reset his password from his login
      java.util.List<java.lang.String> selectUserGroupsFromLogin​(java.lang.String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Find user's groups by login
      java.util.List<java.lang.String> selectUserRolesFromLogin​(java.lang.String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Find user's roles by login
      void updateResetPasswordFromLogin​(java.lang.String strUserName, boolean bNewValue, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Update the reset password attribut of a user from his login
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DatabaseDAO

        public DatabaseDAO()
    • Method Detail

      • selectLuteceUserByLogin

        public BaseUser selectLuteceUserByLogin​(java.lang.String strLogin,
                                                fr.paris.lutece.portal.service.plugin.Plugin plugin,
                                                fr.paris.lutece.portal.service.security.LuteceAuthentication authenticationService)
        Find DatabaseUser by login
        Specified by:
        selectLuteceUserByLogin in interface IDatabaseDAO
        Parameters:
        strLogin - the login
        plugin - The Plugin using this data access service
        authenticationService - the LuteceAuthentication object
        Returns:
        DatabaseUser the user corresponding to the login
      • selectResetPasswordFromLogin

        public boolean selectResetPasswordFromLogin​(java.lang.String strLogin,
                                                    fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Check if a user has reset his password from his login
        Specified by:
        selectResetPasswordFromLogin in interface IDatabaseDAO
        Parameters:
        strLogin - the login
        plugin - The Plugin using this data access service
        Returns:
        boolean true if the password vhas been reset, false otherwise
      • selectPasswordMaxValideDateFromLogin

        public java.sql.Timestamp selectPasswordMaxValideDateFromLogin​(java.lang.String strLogin,
                                                                       fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Gets the password max valid date of a user from his login.
        Specified by:
        selectPasswordMaxValideDateFromLogin in interface IDatabaseDAO
        Parameters:
        strLogin - the login of the user
        plugin - The plugin
        Returns:
        The date of end of validity of the password of the user, or null if none has been set.
      • selectLuteceUserList

        public java.util.Collection<BaseUser> selectLuteceUserList​(fr.paris.lutece.portal.service.plugin.Plugin plugin,
                                                                   fr.paris.lutece.portal.service.security.LuteceAuthentication authenticationService)
        Load the list of BaseUser
        Specified by:
        selectLuteceUserList in interface IDatabaseDAO
        Parameters:
        plugin - The Plugin using this data access service
        authenticationService - the authentication service
        Returns:
        The Collection of the BaseUser
      • selectUserRolesFromLogin

        public java.util.List<java.lang.String> selectUserRolesFromLogin​(java.lang.String strLogin,
                                                                         fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Find user's roles by login
        Specified by:
        selectUserRolesFromLogin in interface IDatabaseDAO
        Parameters:
        strLogin - the login
        plugin - 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:
        deleteRolesForUser in interface IDatabaseDAO
        Parameters:
        nIdUser - The id of the user
        plugin - The Plugin using this data access service
      • createRoleForUser

        public void createRoleForUser​(int nIdUser,
                                      java.lang.String strRoleKey,
                                      fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Assign a role to user
        Specified by:
        createRoleForUser in interface IDatabaseDAO
        Parameters:
        nIdUser - The id of the user
        strRoleKey - The key of the role
        plugin - The Plugin using this data access service
      • selectUserGroupsFromLogin

        public java.util.List<java.lang.String> selectUserGroupsFromLogin​(java.lang.String strLogin,
                                                                          fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Find user's groups by login
        Specified by:
        selectUserGroupsFromLogin in interface IDatabaseDAO
        Parameters:
        strLogin - The login
        plugin - The Plugin using this data access service
        Returns:
        ArrayList the group key list corresponding to the login
      • selectLoginListForRoleKey

        public java.util.Collection<java.lang.String> selectLoginListForRoleKey​(java.lang.String strRoleKey,
                                                                                fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Load the list of DatabaseUsers for a Lutece role
        Specified by:
        selectLoginListForRoleKey in interface IDatabaseDAO
        Parameters:
        strRoleKey - The role key of DatabaseUser
        plugin - 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:
        deleteGroupsForUser in interface IDatabaseDAO
        Parameters:
        nIdUser - The id of the user
        plugin - The Plugin using this data access service
      • createGroupForUser

        public void createGroupForUser​(int nIdUser,
                                       java.lang.String strGroupKey,
                                       fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Assign a group to user
        Specified by:
        createGroupForUser in interface IDatabaseDAO
        Parameters:
        nIdUser - The id of the user
        strGroupKey - The key of the group
        plugin - The Plugin using this data access service
      • selectGroupUsersFromGroupKey

        public java.util.List<DatabaseUser> selectGroupUsersFromGroupKey​(java.lang.String strGroupKey,
                                                                         fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Find assigned users to the given group
        Specified by:
        selectGroupUsersFromGroupKey in interface IDatabaseDAO
        Parameters:
        strGroupKey - The group key
        plugin - Plugin
        Returns:
        a list of DatabaseUser
      • updateResetPasswordFromLogin

        public void updateResetPasswordFromLogin​(java.lang.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:
        updateResetPasswordFromLogin in interface IDatabaseDAO
        Parameters:
        strUserName - Login of the user to update
        bNewValue - New value
        plugin - The plugin
      • findUserIdFromLogin

        public int findUserIdFromLogin​(java.lang.String strLogin,
                                       fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Get the id of a user from his login
        Specified by:
        findUserIdFromLogin in interface IDatabaseDAO
        Parameters:
        strLogin - Login of the user
        plugin - The plugin
        Returns:
        The id of the user