public class UserPrincipal extends Object implements NuxeoPrincipal, Serializable
TODO this should replace the DetachedNuxeoPrincipal from user manager to minimize principal implementations.
Modifier and Type | Field and Description |
---|---|
protected boolean |
administrator |
protected boolean |
anonymous |
protected String |
company |
protected String |
email |
protected String |
firstName |
protected List<String> |
groups |
protected String |
lastName |
protected DocumentModel |
model |
protected String |
originatingUser |
protected String |
password |
protected List<String> |
roles |
protected String |
userName |
PREFIX, TRANSIENT_USER_FORMAT, TRANSIENT_USER_PREFIX
Constructor and Description |
---|
UserPrincipal(String username,
List<String> groups,
boolean anonymous,
boolean administrator) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
String |
getActingUser()
Gets the acting user for this 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()
Gets the base user from which this principal was created, or
null if this principal was not created from
another user. |
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.
|
String |
getTenantId()
Returns the
tenantId of this , or null if there is no
tenantId . |
int |
hashCode() |
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.
|
boolean |
isTransient()
Returns true if the principal is a transient principal.
|
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)
Sets the originating user.
|
void |
setPassword(String password) |
void |
setPrincipalId(String principalId)
Sets the principalId.
|
void |
setRoles(List<String> roles) |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
computeTransientUsername, isTransientUsername
protected boolean anonymous
protected boolean administrator
protected DocumentModel model
protected String originatingUser
public UserPrincipal(String username, List<String> groups, boolean anonymous, boolean administrator)
public String getEmail()
NuxeoPrincipal
getEmail
in interface NuxeoPrincipal
public void setEmail(String email)
setEmail
in interface NuxeoPrincipal
public String getCompany()
NuxeoPrincipal
getCompany
in interface NuxeoPrincipal
public String getFirstName()
NuxeoPrincipal
getFirstName
in interface NuxeoPrincipal
public String getLastName()
NuxeoPrincipal
getLastName
in interface NuxeoPrincipal
public void setCompany(String company)
setCompany
in interface NuxeoPrincipal
public void setFirstName(String firstName)
setFirstName
in interface NuxeoPrincipal
public void setLastName(String lastName)
setLastName
in interface NuxeoPrincipal
public void setName(String name)
setName
in interface NuxeoPrincipal
public List<String> getGroups()
NuxeoPrincipal
getGroups
in interface NuxeoPrincipal
public List<String> getAllGroups()
NuxeoPrincipal
getAllGroups
in interface NuxeoPrincipal
public List<String> getRoles()
NuxeoPrincipal
getRoles
in interface NuxeoPrincipal
public void setGroups(List<String> groups)
setGroups
in interface NuxeoPrincipal
public void setRoles(List<String> roles)
setRoles
in interface NuxeoPrincipal
public String getPassword()
NuxeoPrincipal
Note: Some APIs that return principals from the database intentionally do not fill this field
getPassword
in interface NuxeoPrincipal
public void setPassword(String password)
setPassword
in interface NuxeoPrincipal
public String getPrincipalId()
NuxeoPrincipal
getPrincipalId
in interface NuxeoPrincipal
public void setPrincipalId(String principalId)
NuxeoPrincipal
setPrincipalId
in interface NuxeoPrincipal
principalId
- a new principalId for this instancepublic DocumentModel getModel()
getModel
in interface NuxeoPrincipal
public void setModel(DocumentModel model)
setModel
in interface NuxeoPrincipal
public boolean isMemberOf(String group)
NuxeoPrincipal
isMemberOf
in interface NuxeoPrincipal
group
- The name of the grouppublic int hashCode()
public boolean isAdministrator()
NuxeoPrincipal
Security checks still apply on the repository for administrator user. If user is a system user, this method will return true.
isAdministrator
in interface NuxeoPrincipal
public String getTenantId()
NuxeoPrincipal
tenantId
of this , or null
if there is no
tenantId
.getTenantId
in interface NuxeoPrincipal
public boolean isAnonymous()
NuxeoPrincipal
isAnonymous
in interface NuxeoPrincipal
public String getOriginatingUser()
NuxeoPrincipal
null
if this principal was not created from
another user.getOriginatingUser
in interface NuxeoPrincipal
null
public void setOriginatingUser(String originatingUser)
NuxeoPrincipal
setOriginatingUser
in interface NuxeoPrincipal
originatingUser
- the originating userpublic String getActingUser()
NuxeoPrincipal
This is the originating user (usually when this principal is a system user), or if there is none this principal's user.
getActingUser
in interface NuxeoPrincipal
public boolean isTransient()
NuxeoPrincipal
isTransient
in interface NuxeoPrincipal
Copyright © 2018 Nuxeo. All rights reserved.