Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.usermanager
Class DetachedNuxeoPrincipal

java.lang.Object
  extended by org.nuxeo.ecm.platform.usermanager.DetachedNuxeoPrincipal
All Implemented Interfaces:
Serializable, Principal, NuxeoPrincipal

public class DetachedNuxeoPrincipal
extends Object
implements NuxeoPrincipal

Describes a detached NuxeoPrincipal.

Author:
Mariana Cedica
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.nuxeo.ecm.core.api.NuxeoPrincipal
PREFIX
 
Constructor Summary
DetachedNuxeoPrincipal(String principalId, String name, String firstName, String lastName, String password, String email, String company, List<String> groups, List<String> allGroups, List<String> roles, boolean isAdministrator, boolean isAnonymous)
           
 
Method Summary
static DetachedNuxeoPrincipal detach(NuxeoPrincipal principal)
           
 List<String> getAllGroups()
          Gets the groups this principal directly or undirectly is member of.
 String getCompany()
          Gets the company name of this principal.
 String getEmail()
          Get the user email if any.
 String getFirstName()
          Gets the first name of this principal.
 List<String> getGroups()
          Gets the groups this principal is directly member of.
 String getLastName()
          Gets the last name of this principal.
 DocumentModel getModel()
           
 String getName()
           
 String getOriginatingUser()
           
 String getPassword()
          Gets the password of this principal.
 String getPrincipalId()
          Returns a generated id that is unique for each principal instance.
 List<String> getRoles()
          Gets the roles for this principal.
 boolean isAdministrator()
          Returns true if the principal is an administrator.
 boolean isAnonymous()
          Checks if the principal is anonymous (guest user).
 boolean isMemberOf(String group)
          Recursively test if the user is member of this group.
 void setCompany(String company)
           
 void setEmail(String email)
           
 void setFirstName(String firstName)
           
 void setGroups(List<String> groups)
           
 void setLastName(String lastName)
           
 void setModel(DocumentModel model)
           
 void setName(String name)
           
 void setOriginatingUser(String originatingUser)
           
 void setPassword(String password)
           
 void setPrincipalId(String principalId)
          Sets the principalId.
 void setRoles(List<String> roles)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.security.Principal
equals, hashCode, toString
 

Constructor Detail

DetachedNuxeoPrincipal

public DetachedNuxeoPrincipal(String principalId,
                              String name,
                              String firstName,
                              String lastName,
                              String password,
                              String email,
                              String company,
                              List<String> groups,
                              List<String> allGroups,
                              List<String> roles,
                              boolean isAdministrator,
                              boolean isAnonymous)
Method Detail

detach

public static DetachedNuxeoPrincipal detach(NuxeoPrincipal principal)

getName

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

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

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

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

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

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

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

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

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

getRoles

public List<String> getRoles()
Description copied from interface: NuxeoPrincipal
Gets the roles for this principal.

Specified by:
getRoles in interface NuxeoPrincipal
Returns:
the list of the roles

setName

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

setFirstName

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

setLastName

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

setGroups

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

setRoles

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

setEmail

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

setCompany

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

setPassword

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

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

getModel

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

setModel

public void setModel(DocumentModel model)
              throws ClientException
Specified by:
setModel in interface NuxeoPrincipal
Throws:
ClientException

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.

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.

getOriginatingUser

public String getOriginatingUser()
Specified by:
getOriginatingUser in interface NuxeoPrincipal

setOriginatingUser

public void setOriginatingUser(String originatingUser)
Specified by:
setOriginatingUser in interface NuxeoPrincipal

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.