Class DatabaseHome


  • public final class DatabaseHome
    extends java.lang.Object
    This class provides instances management methods (create, find, ...) for databaseUser objects
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addGroupForUser​(int nIdUser, java.lang.String strGroupKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Assign a group to user
      static void addRoleForUser​(int nIdUser, java.lang.String strRoleKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Assign a role to user
      static java.util.Collection<BaseUser> findDatabaseUsersList​(fr.paris.lutece.portal.service.plugin.Plugin plugin, fr.paris.lutece.portal.service.security.LuteceAuthentication authenticationService)
      Load the list of BaseUser
      static java.util.Collection<java.lang.String> findDatabaseUsersListForRoleKey​(java.lang.String strRoleKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Returns a collection of DatabaseUser objects for a Lutece role
      static java.util.List<DatabaseUser> findGroupUsersFromGroupKey​(java.lang.String strGroupKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Find assigned users to the given group
      static BaseUser findLuteceUserByLogin​(java.lang.String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin, fr.paris.lutece.portal.service.security.LuteceAuthentication authenticationService)
      Find users by login
      static java.sql.Timestamp findPasswordMaxValideDateFromLogin​(java.lang.String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Gets the expiration date of the user's password
      static boolean findResetPasswordFromLogin​(java.lang.String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Gets the reset password attribute of the user from his login
      static java.util.List<java.lang.String> findUserGroupsFromLogin​(java.lang.String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Find user's groups by login
      static int findUserIdFromLogin​(java.lang.String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Get the id of a user from his login
      static java.util.List<java.lang.String> findUserRolesFromLogin​(java.lang.String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Find user's roles by login
      static void removeGroupsForUser​(int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Delete groups for a user
      static void removeRolesForUser​(int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Delete roles for a user
      static 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
    • Method Detail

      • findLuteceUserByLogin

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

        public static boolean findResetPasswordFromLogin​(java.lang.String strLogin,
                                                         fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Gets the reset password attribute of the user from his login
        Parameters:
        strLogin - the login
        plugin - The Plugin using this data access service
        Returns:
        True if the password has to be changed, false otherwise
      • findPasswordMaxValideDateFromLogin

        public static java.sql.Timestamp findPasswordMaxValideDateFromLogin​(java.lang.String strLogin,
                                                                            fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Gets the expiration date of the user's password
        Parameters:
        strLogin - The login of the user
        plugin - The plugin
        Returns:
        The expiration date of the user's password
      • findDatabaseUsersList

        public static java.util.Collection<BaseUser> findDatabaseUsersList​(fr.paris.lutece.portal.service.plugin.Plugin plugin,
                                                                           fr.paris.lutece.portal.service.security.LuteceAuthentication authenticationService)
        Load the list of BaseUser
        Parameters:
        plugin - The Plugin using this data access service
        authenticationService - the authentication service
        Returns:
        The Collection of the BaseUser
      • findUserRolesFromLogin

        public static java.util.List<java.lang.String> findUserRolesFromLogin​(java.lang.String strLogin,
                                                                              fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Find user's roles by login
        Parameters:
        strLogin - the login
        plugin - The Plugin using this data access service
        Returns:
        ArrayList the role key list corresponding to the login
      • removeRolesForUser

        public static void removeRolesForUser​(int nIdUser,
                                              fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Delete roles for a user
        Parameters:
        nIdUser - The id of the user
        plugin - The Plugin using this data access service
      • addRoleForUser

        public static void addRoleForUser​(int nIdUser,
                                          java.lang.String strRoleKey,
                                          fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Assign a role to user
        Parameters:
        nIdUser - The id of the user
        strRoleKey - The key of the role
        plugin - The Plugin using this data access service
      • findUserGroupsFromLogin

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

        public static void removeGroupsForUser​(int nIdUser,
                                               fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Delete groups for a user
        Parameters:
        nIdUser - The id of the user
        plugin - The Plugin using this data access service
      • addGroupForUser

        public static void addGroupForUser​(int nIdUser,
                                           java.lang.String strGroupKey,
                                           fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Assign a group to user
        Parameters:
        nIdUser - The id of the user
        strGroupKey - The key of the group
        plugin - The Plugin using this data access service
      • findDatabaseUsersListForRoleKey

        public static java.util.Collection<java.lang.String> findDatabaseUsersListForRoleKey​(java.lang.String strRoleKey,
                                                                                             fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Returns a collection of DatabaseUser objects for a Lutece role
        Parameters:
        strRoleKey - The role of the databseUser
        plugin - The current plugin using this method
        Returns:
        A collection of logins
      • findGroupUsersFromGroupKey

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

        public static 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
        Parameters:
        strUserName - Login of the user to update
        bNewValue - New value
        plugin - the plugin
      • findUserIdFromLogin

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