Class NuxeoPrincipalImpl

java.lang.Object
org.nuxeo.ecm.platform.usermanager.NuxeoPrincipalImpl
All Implemented Interfaces:
Serializable, Principal, NuxeoPrincipal
Direct Known Subclasses:
MultiTenantPrincipal, NuxeoPrincipalImpl.TransferableClone

public class NuxeoPrincipalImpl extends Object implements NuxeoPrincipal
See Also:
  • Field Details

    • config

      protected UserConfig config
    • roles

      public final List<String> roles
    • virtualGroups

      public List<String> virtualGroups
    • allGroups

      public List<String> allGroups
    • isAnonymous

      public final boolean isAnonymous
    • isAdministrator

      public boolean isAdministrator
    • principalId

      public String principalId
    • model

      public DocumentModel model
    • dataModel

      public DataModel dataModel
    • origUserName

      public String origUserName
  • Constructor Details

    • NuxeoPrincipalImpl

      public NuxeoPrincipalImpl(String name)
      Constructor that sets principal to not anonymous, not administrator, and updates all the principal groups.
    • NuxeoPrincipalImpl

      public NuxeoPrincipalImpl(String name, boolean isAnonymous)
      Constructor that sets principal to not administrator, and updates all the principal groups.
    • NuxeoPrincipalImpl

      public NuxeoPrincipalImpl(String name, boolean isAnonymous, boolean isAdministrator)
      Constructor that updates all the principal groups.
    • NuxeoPrincipalImpl

      public NuxeoPrincipalImpl(String name, boolean isAnonymous, boolean isAdministrator, boolean updateAllGroups)
    • NuxeoPrincipalImpl

      protected NuxeoPrincipalImpl(NuxeoPrincipalImpl other)
  • Method Details

    • setConfig

      public void setConfig(UserConfig config)
    • getConfig

      public UserConfig getConfig()
    • getCompany

      public String getCompany()
      Description copied from interface: NuxeoPrincipal
      Gets the company name of this principal.
      Specified by:
      getCompany in interface NuxeoPrincipal
      Returns:
      the company name
    • setCompany

      public void setCompany(String company)
      Specified by:
      setCompany in interface NuxeoPrincipal
    • getFirstName

      public String getFirstName()
      Description copied from interface: NuxeoPrincipal
      Gets the first name of this principal.
      Specified by:
      getFirstName in interface NuxeoPrincipal
      Returns:
      the first name of this principal
    • setFirstName

      public void setFirstName(String firstName)
      Specified by:
      setFirstName in interface NuxeoPrincipal
    • getLastName

      public String getLastName()
      Description copied from interface: NuxeoPrincipal
      Gets the last name of this principal.
      Specified by:
      getLastName in interface NuxeoPrincipal
      Returns:
      the last name of this principal
    • setLastName

      public void setLastName(String lastName)
      Specified by:
      setLastName in interface NuxeoPrincipal
    • setName

      public void setName(String name)
      Specified by:
      setName in interface NuxeoPrincipal
    • setRoles

      public void setRoles(List<String> roles)
      Specified by:
      setRoles in interface NuxeoPrincipal
    • setGroups

      public void setGroups(List<String> groups)
      Specified by:
      setGroups in interface NuxeoPrincipal
    • getName

      public String getName()
      Specified by:
      getName in interface Principal
    • getGroups

      public List<String> getGroups()
      Description copied from interface: NuxeoPrincipal
      Gets the groups this principal is directly member of.
      Specified by:
      getGroups in interface NuxeoPrincipal
      Returns:
      the list of the groups
    • getRoles

      @Deprecated public List<String> getRoles()
      Deprecated.
      Description copied from interface: NuxeoPrincipal
      Gets the roles for this principal.
      Specified by:
      getRoles in interface NuxeoPrincipal
      Returns:
      the list of the roles
    • setPassword

      public void setPassword(String password)
      Specified by:
      setPassword in interface NuxeoPrincipal
    • getPassword

      public String getPassword()
      Description copied from interface: NuxeoPrincipal
      Gets the password of this principal.

      Note: Some APIs that return principals from the database intentionally do not fill this field

      Specified by:
      getPassword in interface NuxeoPrincipal
      Returns:
      the password of this principal
    • toString

      public String toString()
      Specified by:
      toString in interface Principal
      Overrides:
      toString in class Object
    • getPrincipalId

      public String getPrincipalId()
      Description copied from interface: NuxeoPrincipal
      Returns a generated id that is unique for each principal instance.
      Specified by:
      getPrincipalId in interface NuxeoPrincipal
      Returns:
      a unique string
    • setPrincipalId

      public void setPrincipalId(String principalId)
      Description copied from interface: NuxeoPrincipal
      Sets the principalId.
      Specified by:
      setPrincipalId in interface NuxeoPrincipal
      Parameters:
      principalId - a new principalId for this instance
    • getEmail

      public String getEmail()
      Description copied from interface: NuxeoPrincipal
      Get the user email if any. Return null if not email was specified
      Specified by:
      getEmail in interface NuxeoPrincipal
      Returns:
      the user email or null if none
    • setEmail

      public void setEmail(String email)
      Specified by:
      setEmail in interface NuxeoPrincipal
    • getModel

      public DocumentModel getModel()
      Specified by:
      getModel in interface NuxeoPrincipal
    • setModel

      public void setModel(DocumentModel model, boolean updateAllGroups)
      Sets model and recomputes all groups.
    • setModel

      public void setModel(DocumentModel model)
      Specified by:
      setModel in interface NuxeoPrincipal
    • isMemberOf

      public boolean isMemberOf(String group)
      Description copied from interface: NuxeoPrincipal
      Recursively test if the user is member of this group.
      Specified by:
      isMemberOf in interface NuxeoPrincipal
      Parameters:
      group - The name of the group
    • getAllGroups

      public List<String> getAllGroups()
      Description copied from interface: NuxeoPrincipal
      Gets the groups this principal directly or undirectly is member of.
      Specified by:
      getAllGroups in interface NuxeoPrincipal
      Returns:
      the list of the groups
    • updateAllGroups

      public void updateAllGroups()
    • getVirtualGroups

      public List<String> getVirtualGroups()
    • setVirtualGroups

      public void setVirtualGroups(List<String> virtualGroups, boolean updateAllGroups)
    • setVirtualGroups

      public void setVirtualGroups(List<String> virtualGroups)
      Sets virtual groups and recomputes all groups.
    • isAdministrator

      public boolean isAdministrator()
      Description copied from interface: NuxeoPrincipal
      Returns true if the principal is an administrator.

      Security checks still apply on the repository for administrator user. If user is a system user, this method will return true.

      Specified by:
      isAdministrator in interface NuxeoPrincipal
      Returns:
      true if the principal is an administrator.
    • getTenantId

      public String getTenantId()
      Description copied from interface: NuxeoPrincipal
      Returns the tenantId of this NuxeoPrincipal, or null if there is no tenantId.
      Specified by:
      getTenantId in interface NuxeoPrincipal
    • isAnonymous

      public boolean isAnonymous()
      Description copied from interface: NuxeoPrincipal
      Checks if the principal is anonymous (guest user).
      Specified by:
      isAnonymous in interface NuxeoPrincipal
      Returns:
      true if the principal is anonymous.
    • equals

      public boolean equals(Object other)
      Specified by:
      equals in interface Principal
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Principal
      Overrides:
      hashCode in class Object
    • getOriginatingUser

      public String getOriginatingUser()
      Description copied from interface: NuxeoPrincipal
      Gets the base user from which this principal was created, or null if this principal was not created from another user.
      Specified by:
      getOriginatingUser in interface NuxeoPrincipal
      Returns:
      the originating user, or null
    • setOriginatingUser

      public void setOriginatingUser(String originatingUser)
      Description copied from interface: NuxeoPrincipal
      Sets the originating user.
      Specified by:
      setOriginatingUser in interface NuxeoPrincipal
      Parameters:
      originatingUser - the originating user
    • getActingUser

      public String getActingUser()
      Description copied from interface: NuxeoPrincipal
      Gets the acting user for this principal.

      This is the originating user (usually when this principal is a system user), or if there is none this principal's user.

      Specified by:
      getActingUser in interface NuxeoPrincipal
      Returns:
      the acting user
    • isTransient

      public boolean isTransient()
      Description copied from interface: NuxeoPrincipal
      Returns true if the principal is a transient principal.
      Specified by:
      isTransient in interface NuxeoPrincipal
    • cloneTransferable

      protected NuxeoPrincipal cloneTransferable()