|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.security.CmsPrincipal
public abstract class CmsPrincipal
Common methods shared among user and group principals, also contains several utility functions to deal with principal instances.
Field Summary | |
---|---|
protected java.lang.String |
m_description
The description of this principal. |
protected int |
m_flags
The flags of this principal. |
protected CmsUUID |
m_id
The unique id of this principal. |
protected java.lang.String |
m_name
The fully qualified name of this principal. |
Fields inherited from interface org.opencms.security.I_CmsPrincipal |
---|
FLAG_CORE_LIMIT, FLAG_DISABLED, FLAG_ENABLED, FLAG_GROUP_PROJECT_MANAGER, FLAG_GROUP_PROJECT_USER, FLAG_GROUP_ROLE, FLAG_GROUP_VIRTUAL, FLAG_USER_MANAGED, FLAG_USER_WEBUSER, PRINCIPAL_GROUP, PRINCIPAL_USER |
Constructor Summary | |
---|---|
protected |
CmsPrincipal()
Empty constructor for subclassing. |
Method Summary | |
---|---|
int |
compareTo(java.lang.Object obj)
|
boolean |
equals(java.lang.Object obj)
Compares the given object with this principal. |
static java.util.List |
filterCore(java.util.List principals)
Filters out all principals with flags greater than . |
static java.util.List |
filterCoreFlag(java.util.List principals,
int flag)
Filters out all principals that do not have the given flag set, but leaving principals with flags less than untouched. |
static java.util.List |
filterFlag(java.util.List principals,
int flag)
Filters out all principals that do not have the given flag set. |
java.lang.String |
getDescription()
Returns the description of this principal. |
java.lang.String |
getDisplayName(CmsObject cms,
java.util.Locale locale)
Returns the display name of this principal including the organizational unit. |
int |
getFlags()
Returns the flags of this principal. |
CmsUUID |
getId()
Returns the unique id of this principal. |
java.lang.String |
getName()
Returns the fully qualified name of this principal. |
java.lang.String |
getOuFqn()
Returns the fully qualified name of the associated organizational unit. |
static java.lang.String |
getPrefixedGroup(java.lang.String name)
Returns the provided group name prefixed with
|
java.lang.String |
getPrefixedName()
Returns this principals unique name prefixed with it's type. |
static java.lang.String |
getPrefixedUser(java.lang.String name)
Returns the provided user name prefixed with
|
java.lang.String |
getSimpleName()
Returns the simple name of this organizational unit. |
int |
hashCode()
Returns the hash code of this object. |
boolean |
isEnabled()
Returns true if this principal is enabled. |
boolean |
isGroup()
Returns true if this principal is of type . |
boolean |
isUser()
Returns true if this principal is of type . |
static I_CmsPrincipal |
readPrefixedPrincipal(CmsObject cms,
java.lang.String name)
Utility function to read a prefixed principal from the OpenCms database using the provided OpenCms user context. |
static I_CmsPrincipal |
readPrincipal(CmsObject cms,
CmsUUID id)
Utility function to read a principal by its id from the OpenCms database using the provided OpenCms user context. |
static I_CmsPrincipal |
readPrincipal(CmsObject cms,
java.lang.String type,
java.lang.String name)
Utility function to read a principal of the given type from the OpenCms database using the provided OpenCms user context. |
static I_CmsPrincipal |
readPrincipalIncludingHistory(CmsObject cms,
CmsUUID id)
Utility function to read a principal by its id from the OpenCms database using the provided OpenCms user context. |
void |
setDescription(java.lang.String description)
Sets the description of this principal. |
void |
setEnabled(boolean enabled)
Enables (or disables) this principal, depending on the given status. |
void |
setFlags(int value)
Sets this principals flags to the specified value. |
void |
setName(java.lang.String name)
Sets the unique name of this principal. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.opencms.security.I_CmsPrincipal |
---|
checkName |
Methods inherited from interface java.security.Principal |
---|
toString |
Field Detail |
---|
protected java.lang.String m_description
protected int m_flags
protected CmsUUID m_id
protected java.lang.String m_name
Constructor Detail |
---|
protected CmsPrincipal()
Method Detail |
---|
public static java.util.List filterCore(java.util.List principals)
I_CmsPrincipal.FLAG_CORE_LIMIT
.The given parameter list is directly modified, so the returned list is the same object as the input list.
principals
- a list of CmsPrincipal
objects
public static java.util.List filterCoreFlag(java.util.List principals, int flag)
I_CmsPrincipal.FLAG_CORE_LIMIT
untouched.The given parameter list is directly modified, so the returned list is the same object as the input list.
principals
- a list of CmsPrincipal
objectsflag
- the flag for filtering
public static java.util.List filterFlag(java.util.List principals, int flag)
The given parameter list is directly modified, so the returned list is the same object as the input list.
principals
- the list of CmsPrincipal
objectsflag
- the flag for filtering
public static java.lang.String getPrefixedGroup(java.lang.String name)
I_CmsPrincipal.PRINCIPAL_GROUP
.
.
name
- the name to add the prefix to
I_CmsPrincipal.PRINCIPAL_GROUP
.
public static java.lang.String getPrefixedUser(java.lang.String name)
I_CmsPrincipal.PRINCIPAL_USER
.
.
name
- the name to add the prefix to
I_CmsPrincipal.PRINCIPAL_USER
.
public static I_CmsPrincipal readPrefixedPrincipal(CmsObject cms, java.lang.String name) throws CmsException
The principal must be either prefixed with
or
I_CmsPrincipal.PRINCIPAL_GROUP
.
.I_CmsPrincipal.PRINCIPAL_USER
.
cms
- the OpenCms user context to use when reading the principalname
- the prefixed principal name
CmsException
- in case the principal could not be readpublic static I_CmsPrincipal readPrincipal(CmsObject cms, CmsUUID id) throws CmsException
cms
- the OpenCms user context to use when reading the principalid
- the id of the principal to read
CmsException
- in case the principal could not be readpublic static I_CmsPrincipal readPrincipal(CmsObject cms, java.lang.String type, java.lang.String name) throws CmsException
The type must either be
or
I_CmsPrincipal.PRINCIPAL_GROUP
.I_CmsPrincipal.PRINCIPAL_USER
cms
- the OpenCms user context to use when reading the principaltype
- the principal typename
- the principal name
CmsException
- in case the principal could not be readpublic static I_CmsPrincipal readPrincipalIncludingHistory(CmsObject cms, CmsUUID id) throws CmsException
cms
- the OpenCms user context to use when reading the principalid
- the id of the principal to read
CmsException
- in case the principal could not be readpublic int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
Comparable.compareTo(java.lang.Object)
public boolean equals(java.lang.Object obj)
I_CmsPrincipal
equals
in interface java.security.Principal
equals
in interface I_CmsPrincipal
equals
in class java.lang.Object
obj
- object to compare
Object.equals(java.lang.Object)
public java.lang.String getDescription()
I_CmsPrincipal
getDescription
in interface I_CmsPrincipal
I_CmsPrincipal.getDescription()
public java.lang.String getDisplayName(CmsObject cms, java.util.Locale locale) throws CmsException
cms
- the cms contextlocale
- the locale
CmsException
- if the organizational unit could not be readpublic int getFlags()
I_CmsPrincipal
The principal flags are used to store special information about the
principals state encoded bitwise. Usually the flags int value should not
be directly accessed. Utility methods like
provide a much easier way to access the information contained in the flags.I_CmsPrincipal.isEnabled()
getFlags
in interface I_CmsPrincipal
I_CmsPrincipal.getFlags()
public CmsUUID getId()
I_CmsPrincipal
getId
in interface I_CmsPrincipal
I_CmsPrincipal.getId()
public java.lang.String getName()
getName
in interface java.security.Principal
getName
in interface I_CmsPrincipal
Principal.getName()
public java.lang.String getOuFqn()
getOuFqn
in interface I_CmsPrincipal
public java.lang.String getPrefixedName()
I_CmsPrincipal
The type prefix can either be
(for groups) or I_CmsPrincipal.PRINCIPAL_GROUP
.
(for users).I_CmsPrincipal.PRINCIPAL_USER
.
getPrefixedName
in interface I_CmsPrincipal
I_CmsPrincipal.getPrefixedName()
public java.lang.String getSimpleName()
getSimpleName
in interface I_CmsPrincipal
public int hashCode()
I_CmsPrincipal
hashCode
in interface java.security.Principal
hashCode
in interface I_CmsPrincipal
hashCode
in class java.lang.Object
Object.hashCode()
public boolean isEnabled()
I_CmsPrincipal
true
if this principal is enabled.A principal may be disabled in order to disable it, for example to prevent logins of a user. If a principal is just disabled but not deleted, the credentials of the principal in the VFS are still valid.
isEnabled
in interface I_CmsPrincipal
true
if this principal is enabledI_CmsPrincipal.isEnabled()
public boolean isGroup()
I_CmsPrincipal
true
if this principal is of type CmsGroup
.
isGroup
in interface I_CmsPrincipal
true
if this principal is of type CmsGroup
I_CmsPrincipal.isGroup()
public boolean isUser()
I_CmsPrincipal
true
if this principal is of type CmsUser
.
isUser
in interface I_CmsPrincipal
true
if this principal is of type CmsUser
I_CmsPrincipal.isUser()
public void setDescription(java.lang.String description)
I_CmsPrincipal
setDescription
in interface I_CmsPrincipal
description
- the principal description to setI_CmsPrincipal.setDescription(java.lang.String)
public void setEnabled(boolean enabled)
I_CmsPrincipal
setEnabled
in interface I_CmsPrincipal
enabled
- the principal status to setI_CmsPrincipal.setEnabled(boolean)
public void setFlags(int value)
I_CmsPrincipal
The principal flags are used to store special information about the
principals state encoded bitwise. Usually the flags integer value should not
be directly accessed. Utility methods like
provide a much easier way to manipulate the information contained in the flags.I_CmsPrincipal.setEnabled(boolean)
setFlags
in interface I_CmsPrincipal
value
- the value to set this principals flags toI_CmsPrincipal.setFlags(int)
public void setName(java.lang.String name)
I_CmsPrincipal
setName
in interface I_CmsPrincipal
name
- the unique name of this principal to setI_CmsPrincipal.setName(java.lang.String)
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |