Class AdminUser

  • All Implemented Interfaces:
    fr.paris.lutece.api.user.User, fr.paris.lutece.portal.service.workgroup.AdminWorkgroupResource, Serializable
    Direct Known Subclasses:
    LuteceDefaultAdminUser

    public class AdminUser
    extends Object
    implements Serializable, fr.paris.lutece.portal.service.workgroup.AdminWorkgroupResource, fr.paris.lutece.api.user.User
    This Interface defines all methods required for an admin user implementation
    See Also:
    Serialized Form
    • Constructor Detail

      • AdminUser

        public AdminUser()
        Constructor
      • AdminUser

        public AdminUser​(String stAccessCode,
                         AdminAuthentication authenticationService)
        Constructor
        Parameters:
        stAccessCode - The User Name
        authenticationService - The PortalAuthentication object
    • Method Detail

      • init

        public static void init()
        Init
      • getLocale

        @NotNull
        public @NotNull Locale getLocale()
        Get the user's Locale
        Returns:
        The user's locale
      • setLocale

        public void setLocale​(Locale locale)
        Set the user Locale
        Parameters:
        locale - The locale
      • getUserId

        public int getUserId()
        Return the user's id
        Returns:
        The user id
      • setUserId

        public void setUserId​(int nUserId)
        Sets the user's id
        Parameters:
        nUserId - The User id
      • getStatus

        public int getStatus()
        Returns:
        Returns the status. Only ACTIVE_CODE, NOT_ACTIVE_CODE or ANONYMIZED_CODE are returned. If the status in an other status, then its equivalent is returned
      • getRealStatus

        public int getRealStatus()
        Returns:
        Returns the real status of the user.
      • setStatus

        public void setStatus​(int nStatus)
        Parameters:
        nStatus - The _nStatus to set.
      • isStatusActive

        public boolean isStatusActive()
        Tells whether the current user is active or not
        Returns:
        true if active, false otherwise
      • isStatusAnonymized

        public boolean isStatusAnonymized()
        Tells whether the current user is anonymized
        Returns:
        true if anonymized, false otherwise
      • getLastName

        public String getLastName()
        Returns the last name of this user.
        Specified by:
        getLastName in interface fr.paris.lutece.api.user.User
        Returns:
        the user last name
      • setLastName

        public void setLastName​(String strLastName)
        Sets the last name of the user to the specified string.
        Parameters:
        strLastName - the new last name
      • getFirstName

        public String getFirstName()
        Returns the first name of this user.
        Specified by:
        getFirstName in interface fr.paris.lutece.api.user.User
        Returns:
        the user first name
      • setFirstName

        public void setFirstName​(String strFirstName)
        Sets the first name of the user to the specified string.
        Parameters:
        strFirstName - the new first name
      • getEmail

        public String getEmail()
        Returns the email of this user.
        Specified by:
        getEmail in interface fr.paris.lutece.api.user.User
        Returns:
        the user email
      • setEmail

        public void setEmail​(String strEmail)
        Sets the email of the user to the specified string.
        Parameters:
        strEmail - the new email
      • getAccessCode

        public String getAccessCode()
        Specified by:
        getAccessCode in interface fr.paris.lutece.api.user.User
        Returns:
        Returns the _strAccessCode.
      • setAccessCode

        public void setAccessCode​(String strAccessCode)
        Parameters:
        strAccessCode - The _strAccessCode to set.
      • getPasswordMaxValidDate

        public Timestamp getPasswordMaxValidDate()
        Get the maximum valid date of the password of the user
        Returns:
        The maximum valid date of the password of the user
      • setPasswordMaxValidDate

        public void setPasswordMaxValidDate​(Timestamp passwordMaxValidDate)
        Set the maximum valid date of the password of the user
        Parameters:
        passwordMaxValidDate - The new maximum valid date of the password of the user, or null if it doesn't have any.
      • getAccountMaxValidDate

        public Timestamp getAccountMaxValidDate()
        Get the expiration date of the user account.
        Returns:
        The expiration date of the user account, or null if it doesn't have any.
      • setAccountMaxValidDate

        public void setAccountMaxValidDate​(Timestamp accountMaxValidDate)
        Set the expiration date of the user account.
        Parameters:
        accountMaxValidDate - The new expiration date of the user account.
      • getRoles

        @Deprecated
        public Map<String,​fr.paris.lutece.api.user.UserRole> getRoles()
        Deprecated.
        use getRBACRoles( )
        Returns user's roles
        Returns:
        Returns user's roles
      • getUserRoles

        public Map<String,​fr.paris.lutece.api.user.UserRole> getUserRoles()
        Specified by:
        getUserRoles in interface fr.paris.lutece.api.user.User
      • addRoles

        public void addRoles​(Map<String,​RBACRole> roles)
        add user's roles
        Parameters:
        roles - The User roles
      • setRoles

        public void setRoles​(Map<String,​RBACRole> roles)
        Defines user's roles
        Parameters:
        roles - The User roles
      • getRights

        public Map<String,​Right> getRights()
        Returns user's rights
        Returns:
        Returns user's rights
      • checkRight

        public boolean checkRight​(String strRightCode)
        Verify user rights on a given functionality
        Parameters:
        strRightCode - right code which corresponding to the functionality
        Returns:
        true if user have this authorisation and false otherwise
      • setRights

        public void setRights​(Map<String,​Right> rights)
        Defines user's rights
        Parameters:
        rights - The User rights
      • updateRight

        public void updateRight​(Right rightToUpdate)
        Update user right
        Parameters:
        rightToUpdate - to update in _rights for user
      • setAuthenticationService

        public void setAuthenticationService​(String strAuthenticationService)
        Defines the authentification service that had authentified the user
        Parameters:
        strAuthenticationService - The authentification service
      • getAuthenticationService

        public String getAuthenticationService()
        Returns the authentification service that had authentified the user
        Returns:
        the authentification service that had authentified the user
      • setAuthenticationType

        public void setAuthenticationType​(String strAuthenticationType)
        Defines the authentification type that had authentified the user
        Parameters:
        strAuthenticationType - The authentification type
      • getAuthenticationType

        public String getAuthenticationType()
        Returns the authentification type that had authentified the user
        Returns:
        the authentification type that had authentified the user
      • setUserLevel

        public void setUserLevel​(int nUserLevel)
        Defines the user level
        Parameters:
        nUserLevel - the user level
      • getUserLevel

        public int getUserLevel()
        Returns the user level
        Returns:
        the user level
      • isParent

        public boolean isParent​(AdminUser user)
        Check if current user has rights over user
        Parameters:
        user - the user to check
        Returns:
        true if current user has higher level than user
      • hasRights

        public boolean hasRights​(int level)
        Check if current user has rights depending on level
        Parameters:
        level - a level id
        Returns:
        true if current user has higher level than level
      • isAdmin

        public boolean isAdmin()
        Check if this user has admin rights
        Returns:
        true if user has admin rights
      • isInRole

        public boolean isInRole​(String strRole)
        Check if this user has a given role
        Parameters:
        strRole - The role key
        Returns:
        true if user has the role
      • isPasswordReset

        public boolean isPasswordReset()
        Check if the password has been reinitialized
        Returns:
        true if it has been reinitialized, false otherwise
      • setPasswordReset

        public void setPasswordReset​(boolean bIsPasswordReset)
        Set pwd reseted
        Parameters:
        bIsPasswordReset - true if it has been reinitialized, false otherwise
      • setAccessibilityMode

        public void setAccessibilityMode​(boolean bAccessibilityMode)
        Set the accessibility mode
        Parameters:
        bAccessibilityMode - true if the mode is accessible, false otherwise
      • getAccessibilityMode

        public boolean getAccessibilityMode()
        Return the accessibility mode
        Returns:
        true if the mode is accessible, false otherwise
      • getDateLastLogin

        public Timestamp getDateLastLogin()
        Get the last login date of the user
        Returns:
        The last login date of the user
      • setDateLastLogin

        public void setDateLastLogin​(Timestamp dateLastLogin)
        Set the last login date of the user
        Parameters:
        dateLastLogin - The last login date of the user
      • getWorkgroupKey

        public String getWorkgroupKey()
        Returns:
        the _strWorkgroupKey
      • setWorkgroupKey

        public void setWorkgroupKey​(String strWorkgroupKey)
        Parameters:
        strWorkgroupKey - the _strWorkgroupKey to set
      • getWorkgroup

        public String getWorkgroup()
        Specified by:
        getWorkgroup in interface fr.paris.lutece.portal.service.workgroup.AdminWorkgroupResource
      • setUserInfo

        public <X> X setUserInfo​(String strKey,
                                 X info)
        Sets a user info for the given key. User infos are intended to be lightweight attributes that do not expose a UI, by opposition the IAttribute system. The user infos are not persisted. Subclasses can choose another strategy.
        Type Parameters:
        X - the value's type stored in the user map info
        Parameters:
        strKey - the key
        info - the info
        Returns:
        the previous value associated with strKey, or null if there was no mapping for strKey. (A null return can also indicate that null was previously associated with strKey)
        Since:
        6.2.0
      • getUserInfo

        public <X> X getUserInfo​(String strKey)
        Gets the user info for a given key
        Type Parameters:
        X - the value's type stored in the user map info
        Parameters:
        strKey - the key
        Returns:
        the info
        Since:
        6.2.0
        See Also:
        setUserInfo(String, Object)
      • getDefaultDateLastLogin

        public static Timestamp getDefaultDateLastLogin()
      • getUserWorkgroups

        public List<String> getUserWorkgroups()
        Specified by:
        getUserWorkgroups in interface fr.paris.lutece.api.user.User
      • setUserWorkgroups

        public void setUserWorkgroups​(List<String> workgroups)
        Defines user's workgroups
        Parameters:
        worgroups - The User workgroups
      • getRealm

        public String getRealm()
        Specified by:
        getRealm in interface fr.paris.lutece.api.user.User