Package org.nuxeo.ecm.core.api.impl
Class UserPrincipal
- java.lang.Object
-
- org.nuxeo.ecm.core.api.impl.UserPrincipal
-
- All Implemented Interfaces:
Serializable
,Principal
,NuxeoPrincipal
public class UserPrincipal extends Object implements NuxeoPrincipal, Serializable
NuxeoPrincipal stub implementation.- Author:
- Bogdan Stefanescu
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field 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
-
Fields inherited from interface org.nuxeo.ecm.core.api.NuxeoPrincipal
PREFIX, TRANSIENT_USER_FORMAT, TRANSIENT_USER_PREFIX, TRANSIENT_USERNAME_UNIQUE_PROP
-
-
Constructor Summary
Constructors Constructor Description UserPrincipal(String username, List<String> groups, boolean anonymous, boolean administrator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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, ornull
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()
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)
String
toString()
-
-
-
Field Detail
-
anonymous
protected boolean anonymous
-
administrator
protected boolean administrator
-
userName
protected String userName
-
firstName
protected String firstName
-
lastName
protected String lastName
-
email
protected String email
-
company
protected String company
-
password
protected transient String password
-
model
protected DocumentModel model
-
originatingUser
protected String originatingUser
-
-
Method Detail
-
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 interfaceNuxeoPrincipal
- Returns:
- the user email or null if none
-
setEmail
public void setEmail(String email)
- Specified by:
setEmail
in interfaceNuxeoPrincipal
-
getCompany
public String getCompany()
Description copied from interface:NuxeoPrincipal
Gets the company name of this principal.- Specified by:
getCompany
in interfaceNuxeoPrincipal
- Returns:
- the company name
-
getFirstName
public String getFirstName()
Description copied from interface:NuxeoPrincipal
Gets the first name of this principal.- Specified by:
getFirstName
in interfaceNuxeoPrincipal
- 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 interfaceNuxeoPrincipal
- Returns:
- the last name of this principal
-
setCompany
public void setCompany(String company)
- Specified by:
setCompany
in interfaceNuxeoPrincipal
-
setFirstName
public void setFirstName(String firstName)
- Specified by:
setFirstName
in interfaceNuxeoPrincipal
-
setLastName
public void setLastName(String lastName)
- Specified by:
setLastName
in interfaceNuxeoPrincipal
-
setName
public void setName(String name)
- Specified by:
setName
in interfaceNuxeoPrincipal
-
getGroups
public List<String> getGroups()
Description copied from interface:NuxeoPrincipal
Gets the groups this principal is directly member of.- Specified by:
getGroups
in interfaceNuxeoPrincipal
- 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 interfaceNuxeoPrincipal
- Returns:
- the list of the groups
-
getRoles
public List<String> getRoles()
Description copied from interface:NuxeoPrincipal
Gets the roles for this principal.- Specified by:
getRoles
in interfaceNuxeoPrincipal
- Returns:
- the list of the roles
-
setGroups
public void setGroups(List<String> groups)
- Specified by:
setGroups
in interfaceNuxeoPrincipal
-
setRoles
public void setRoles(List<String> roles)
- Specified by:
setRoles
in interfaceNuxeoPrincipal
-
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 interfaceNuxeoPrincipal
- Returns:
- the password of this principal
-
setPassword
public void setPassword(String password)
- Specified by:
setPassword
in interfaceNuxeoPrincipal
-
getPrincipalId
public String getPrincipalId()
Description copied from interface:NuxeoPrincipal
Returns a generated id that is unique for each principal instance.- Specified by:
getPrincipalId
in interfaceNuxeoPrincipal
- Returns:
- a unique string
-
setPrincipalId
public void setPrincipalId(String principalId)
Description copied from interface:NuxeoPrincipal
Sets the principalId.- Specified by:
setPrincipalId
in interfaceNuxeoPrincipal
- Parameters:
principalId
- a new principalId for this instance
-
getModel
public DocumentModel getModel()
- Specified by:
getModel
in interfaceNuxeoPrincipal
-
setModel
public void setModel(DocumentModel model)
- Specified by:
setModel
in interfaceNuxeoPrincipal
-
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 interfaceNuxeoPrincipal
- Parameters:
group
- The name of the group
-
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 interfaceNuxeoPrincipal
- Returns:
- true if the principal is an administrator.
-
getTenantId
public String getTenantId()
Description copied from interface:NuxeoPrincipal
- Specified by:
getTenantId
in interfaceNuxeoPrincipal
-
isAnonymous
public boolean isAnonymous()
Description copied from interface:NuxeoPrincipal
Checks if the principal is anonymous (guest user).- Specified by:
isAnonymous
in interfaceNuxeoPrincipal
- Returns:
- true if the principal is anonymous.
-
getOriginatingUser
public String getOriginatingUser()
Description copied from interface:NuxeoPrincipal
Gets the base user from which this principal was created, ornull
if this principal was not created from another user.- Specified by:
getOriginatingUser
in interfaceNuxeoPrincipal
- 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 interfaceNuxeoPrincipal
- 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 interfaceNuxeoPrincipal
- 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 interfaceNuxeoPrincipal
-
hashCode
public int hashCode()
-
equals
public boolean equals(Object o)
-
-