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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classNuxeoPrincipalImpl.TransferableCloneProvides another implementation which marshall the user id instead of transferring the whole content and resolve it when unmarshalled.
-
Field Summary
Fields Modifier and Type Field Description List<String>allGroupsprotected UserConfigconfigDataModeldataModelbooleanisAdministratorbooleanisAnonymousDocumentModelmodelStringorigUserNameStringprincipalIdList<String>rolesList<String>virtualGroups-
Fields inherited from interface org.nuxeo.ecm.core.api.NuxeoPrincipal
PREFIX, TRANSIENT_USER_FORMAT, TRANSIENT_USER_PREFIX, TRANSIENT_USERNAME_UNIQUE_PROP
-
-
Constructor Summary
Constructors Modifier Constructor Description NuxeoPrincipalImpl(String name)Constructor that sets principal to not anonymous, not administrator, and updates all the principal groups.NuxeoPrincipalImpl(String name, boolean isAnonymous)Constructor that sets principal to not administrator, and updates all the principal groups.NuxeoPrincipalImpl(String name, boolean isAnonymous, boolean isAdministrator)Constructor that updates all the principal groups.NuxeoPrincipalImpl(String name, boolean isAnonymous, boolean isAdministrator, boolean updateAllGroups)protectedNuxeoPrincipalImpl(NuxeoPrincipalImpl other)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected NuxeoPrincipalcloneTransferable()booleanequals(Object other)StringgetActingUser()Gets the acting user for this principal.List<String>getAllGroups()Gets the groups this principal directly or undirectly is member of.StringgetCompany()Gets the company name of this principal.UserConfiggetConfig()StringgetEmail()Get the user email if any.StringgetFirstName()Gets the first name of this principal.List<String>getGroups()Gets the groups this principal is directly member of.StringgetLastName()Gets the last name of this principal.DocumentModelgetModel()StringgetName()StringgetOriginatingUser()Gets the base user from which this principal was created, ornullif this principal was not created from another user.StringgetPassword()Gets the password of this principal.StringgetPrincipalId()Returns a generated id that is unique for each principal instance.List<String>getRoles()Deprecated.StringgetTenantId()List<String>getVirtualGroups()inthashCode()booleanisAdministrator()Returns true if the principal is an administrator.booleanisAnonymous()Checks if the principal is anonymous (guest user).booleanisMemberOf(String group)Recursively test if the user is member of this group.booleanisTransient()Returns true if the principal is a transient principal.voidsetCompany(String company)voidsetConfig(UserConfig config)voidsetEmail(String email)voidsetFirstName(String firstName)voidsetGroups(List<String> groups)voidsetLastName(String lastName)voidsetModel(DocumentModel model)voidsetModel(DocumentModel model, boolean updateAllGroups)Sets model and recomputes all groups.voidsetName(String name)voidsetOriginatingUser(String originatingUser)Sets the originating user.voidsetPassword(String password)voidsetPrincipalId(String principalId)Sets the principalId.voidsetRoles(List<String> roles)voidsetVirtualGroups(List<String> virtualGroups)Sets virtual groups and recomputes all groups.voidsetVirtualGroups(List<String> virtualGroups, boolean updateAllGroups)StringtoString()voidupdateAllGroups()
-
-
-
Field Detail
-
config
protected UserConfig config
-
virtualGroups
public List<String> virtualGroups
-
isAnonymous
public final boolean isAnonymous
-
isAdministrator
public boolean isAdministrator
-
principalId
public String principalId
-
model
public DocumentModel model
-
origUserName
public String origUserName
-
-
Constructor Detail
-
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 Detail
-
setConfig
public void setConfig(UserConfig config)
-
getConfig
public UserConfig getConfig()
-
getCompany
public String getCompany()
Description copied from interface:NuxeoPrincipalGets the company name of this principal.- Specified by:
getCompanyin interfaceNuxeoPrincipal- Returns:
- the company name
-
setCompany
public void setCompany(String company)
- Specified by:
setCompanyin interfaceNuxeoPrincipal
-
getFirstName
public String getFirstName()
Description copied from interface:NuxeoPrincipalGets the first name of this principal.- Specified by:
getFirstNamein interfaceNuxeoPrincipal- Returns:
- the first name of this principal
-
setFirstName
public void setFirstName(String firstName)
- Specified by:
setFirstNamein interfaceNuxeoPrincipal
-
getLastName
public String getLastName()
Description copied from interface:NuxeoPrincipalGets the last name of this principal.- Specified by:
getLastNamein interfaceNuxeoPrincipal- Returns:
- the last name of this principal
-
setLastName
public void setLastName(String lastName)
- Specified by:
setLastNamein interfaceNuxeoPrincipal
-
setName
public void setName(String name)
- Specified by:
setNamein interfaceNuxeoPrincipal
-
setRoles
public void setRoles(List<String> roles)
- Specified by:
setRolesin interfaceNuxeoPrincipal
-
setGroups
public void setGroups(List<String> groups)
- Specified by:
setGroupsin interfaceNuxeoPrincipal
-
getGroups
public List<String> getGroups()
Description copied from interface:NuxeoPrincipalGets the groups this principal is directly member of.- Specified by:
getGroupsin interfaceNuxeoPrincipal- Returns:
- the list of the groups
-
getRoles
@Deprecated public List<String> getRoles()
Deprecated.Description copied from interface:NuxeoPrincipalGets the roles for this principal.- Specified by:
getRolesin interfaceNuxeoPrincipal- Returns:
- the list of the roles
-
setPassword
public void setPassword(String password)
- Specified by:
setPasswordin interfaceNuxeoPrincipal
-
getPassword
public String getPassword()
Description copied from interface:NuxeoPrincipalGets the password of this principal.Note: Some APIs that return principals from the database intentionally do not fill this field
- Specified by:
getPasswordin interfaceNuxeoPrincipal- Returns:
- the password of this principal
-
getPrincipalId
public String getPrincipalId()
Description copied from interface:NuxeoPrincipalReturns a generated id that is unique for each principal instance.- Specified by:
getPrincipalIdin interfaceNuxeoPrincipal- Returns:
- a unique string
-
setPrincipalId
public void setPrincipalId(String principalId)
Description copied from interface:NuxeoPrincipalSets the principalId.- Specified by:
setPrincipalIdin interfaceNuxeoPrincipal- Parameters:
principalId- a new principalId for this instance
-
getEmail
public String getEmail()
Description copied from interface:NuxeoPrincipalGet the user email if any. Return null if not email was specified- Specified by:
getEmailin interfaceNuxeoPrincipal- Returns:
- the user email or null if none
-
setEmail
public void setEmail(String email)
- Specified by:
setEmailin interfaceNuxeoPrincipal
-
getModel
public DocumentModel getModel()
- Specified by:
getModelin interfaceNuxeoPrincipal
-
setModel
public void setModel(DocumentModel model, boolean updateAllGroups)
Sets model and recomputes all groups.
-
setModel
public void setModel(DocumentModel model)
- Specified by:
setModelin interfaceNuxeoPrincipal
-
isMemberOf
public boolean isMemberOf(String group)
Description copied from interface:NuxeoPrincipalRecursively test if the user is member of this group.- Specified by:
isMemberOfin interfaceNuxeoPrincipal- Parameters:
group- The name of the group
-
getAllGroups
public List<String> getAllGroups()
Description copied from interface:NuxeoPrincipalGets the groups this principal directly or undirectly is member of.- Specified by:
getAllGroupsin interfaceNuxeoPrincipal- 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:NuxeoPrincipalReturns 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:
isAdministratorin interfaceNuxeoPrincipal- Returns:
- true if the principal is an administrator.
-
getTenantId
public String getTenantId()
Description copied from interface:NuxeoPrincipal- Specified by:
getTenantIdin interfaceNuxeoPrincipal
-
isAnonymous
public boolean isAnonymous()
Description copied from interface:NuxeoPrincipalChecks if the principal is anonymous (guest user).- Specified by:
isAnonymousin interfaceNuxeoPrincipal- Returns:
- true if the principal is anonymous.
-
hashCode
public int hashCode()
-
getOriginatingUser
public String getOriginatingUser()
Description copied from interface:NuxeoPrincipalGets the base user from which this principal was created, ornullif this principal was not created from another user.- Specified by:
getOriginatingUserin interfaceNuxeoPrincipal- Returns:
- the originating user, or
null
-
setOriginatingUser
public void setOriginatingUser(String originatingUser)
Description copied from interface:NuxeoPrincipalSets the originating user.- Specified by:
setOriginatingUserin interfaceNuxeoPrincipal- Parameters:
originatingUser- the originating user
-
getActingUser
public String getActingUser()
Description copied from interface:NuxeoPrincipalGets 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:
getActingUserin interfaceNuxeoPrincipal- Returns:
- the acting user
-
isTransient
public boolean isTransient()
Description copied from interface:NuxeoPrincipalReturns true if the principal is a transient principal.- Specified by:
isTransientin interfaceNuxeoPrincipal
-
cloneTransferable
protected NuxeoPrincipal cloneTransferable()
-
-