Class AdminUser

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

    public class AdminUser
    extends java.lang.Object
    implements java.io.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
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addRoles​(java.util.Map<java.lang.String,​RBACRole> roles)
      add user's roles
      boolean checkRight​(java.lang.String strRightCode)
      Verify user rights on a given functionality
      java.lang.String getAccessCode()  
      boolean getAccessibilityMode()
      Return the accessibility mode
      java.sql.Timestamp getAccountMaxValidDate()
      Get the expiration date of the user account.
      java.lang.String getAuthenticationService()
      Returns the authentification service that had authentified the user
      java.lang.String getAuthenticationType()
      Returns the authentification type that had authentified the user
      java.sql.Timestamp getDateLastLogin()
      Get the last login date of the user
      static java.sql.Timestamp getDefaultDateLastLogin()  
      java.lang.String getEmail()
      Returns the email of this user.
      java.lang.String getFirstName()
      Returns the first name of this user.
      java.lang.String getLastName()
      Returns the last name of this user.
      @NotNull java.util.Locale getLocale()
      Get the user's Locale
      java.sql.Timestamp getPasswordMaxValidDate()
      Get the maximum valid date of the password of the user
      java.lang.String getRealm()
      int getRealStatus()  
      java.util.Map<java.lang.String,​Right> getRights()
      Returns user's rights
      java.util.Map<java.lang.String,​fr.paris.lutece.api.user.UserRole> getRoles()
      Deprecated.
      use getRBACRoles( )
      int getStatus()  
      int getUserId()
      Return the user's id
      <X> X getUserInfo​(java.lang.String strKey)
      Gets the user info for a given key
      int getUserLevel()
      Returns the user level
      java.util.Map<java.lang.String,​fr.paris.lutece.api.user.UserRole> getUserRoles()
      java.util.List<java.lang.String> getUserWorkgroups()
      java.lang.String getWorkgroup()  
      java.lang.String getWorkgroupKey()  
      boolean hasRights​(int level)
      Check if current user has rights depending on level
      static void init()
      Init
      boolean isAdmin()
      Check if this user has admin rights
      boolean isInRole​(java.lang.String strRole)
      Check if this user has a given role
      boolean isParent​(AdminUser user)
      Check if current user has rights over user
      boolean isPasswordReset()
      Check if the password has been reinitialized
      boolean isStatusActive()
      Tells whether the current user is active or not
      boolean isStatusAnonymized()
      Tells whether the current user is anonymized
      void setAccessCode​(java.lang.String strAccessCode)  
      void setAccessibilityMode​(boolean bAccessibilityMode)
      Set the accessibility mode
      void setAccountMaxValidDate​(java.sql.Timestamp accountMaxValidDate)
      Set the expiration date of the user account.
      void setAuthenticationService​(java.lang.String strAuthenticationService)
      Defines the authentification service that had authentified the user
      void setAuthenticationType​(java.lang.String strAuthenticationType)
      Defines the authentification type that had authentified the user
      void setDateLastLogin​(java.sql.Timestamp dateLastLogin)
      Set the last login date of the user
      void setEmail​(java.lang.String strEmail)
      Sets the email of the user to the specified string.
      void setFirstName​(java.lang.String strFirstName)
      Sets the first name of the user to the specified string.
      void setLastName​(java.lang.String strLastName)
      Sets the last name of the user to the specified string.
      void setLocale​(java.util.Locale locale)
      Set the user Locale
      void setPasswordMaxValidDate​(java.sql.Timestamp passwordMaxValidDate)
      Set the maximum valid date of the password of the user
      void setPasswordReset​(boolean bIsPasswordReset)
      Set pwd reseted
      void setRights​(java.util.Map<java.lang.String,​Right> rights)
      Defines user's rights
      void setRoles​(java.util.Map<java.lang.String,​RBACRole> roles)
      Defines user's roles
      void setStatus​(int nStatus)  
      void setUserId​(int nUserId)
      Sets the user's id
      <X> X setUserInfo​(java.lang.String strKey, X info)
      Sets a user info for the given key.
      void setUserLevel​(int nUserLevel)
      Defines the user level
      void setUserWorkgroups​(java.util.List<java.lang.String> workgroups)
      Defines user's workgroups
      void setWorkgroupKey​(java.lang.String strWorkgroupKey)  
      void updateRight​(Right rightToUpdate)
      Update user right
      • Methods inherited from class java.lang.Object

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

      • AdminUser

        public AdminUser()
        Constructor
      • AdminUser

        public AdminUser​(java.lang.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 java.util.Locale getLocale()
        Get the user's Locale
        Returns:
        The user's locale
      • setLocale

        public void setLocale​(java.util.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 java.lang.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​(java.lang.String strLastName)
        Sets the last name of the user to the specified string.
        Parameters:
        strLastName - the new last name
      • getFirstName

        public java.lang.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​(java.lang.String strFirstName)
        Sets the first name of the user to the specified string.
        Parameters:
        strFirstName - the new first name
      • getEmail

        public java.lang.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​(java.lang.String strEmail)
        Sets the email of the user to the specified string.
        Parameters:
        strEmail - the new email
      • getAccessCode

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

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

        public java.sql.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​(java.sql.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 java.sql.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​(java.sql.Timestamp accountMaxValidDate)
        Set the expiration date of the user account.
        Parameters:
        accountMaxValidDate - The new expiration date of the user account.
      • getRoles

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

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

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

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

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

        public boolean checkRight​(java.lang.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​(java.util.Map<java.lang.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​(java.lang.String strAuthenticationService)
        Defines the authentification service that had authentified the user
        Parameters:
        strAuthenticationService - The authentification service
      • getAuthenticationService

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

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

        public java.lang.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​(java.lang.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 java.sql.Timestamp getDateLastLogin()
        Get the last login date of the user
        Returns:
        The last login date of the user
      • setDateLastLogin

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

        public java.lang.String getWorkgroupKey()
        Returns:
        the _strWorkgroupKey
      • setWorkgroupKey

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

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

        public <X> X setUserInfo​(java.lang.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​(java.lang.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 java.sql.Timestamp getDefaultDateLastLogin()
      • getUserWorkgroups

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

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

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