public abstract class CmsPrincipal extends java.lang.Object implements I_CmsPrincipal, java.lang.Comparable<I_CmsPrincipal>
| Modifier and Type | Field and Description |
|---|---|
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.
|
FLAG_CORE_LIMIT, FLAG_DISABLED, FLAG_ENABLED, FLAG_GROUP_ROLE, FLAG_GROUP_VIRTUAL, FLAG_USER_MANAGED, FLAG_USER_WEBUSER, PRINCIPAL_GROUP, PRINCIPAL_USER| Modifier | Constructor and Description |
|---|---|
protected |
CmsPrincipal()
Empty constructor for subclassing.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(I_CmsPrincipal obj) |
boolean |
equals(java.lang.Object obj)
Compares the given object with this principal.
|
static java.util.List<? extends CmsPrincipal> |
filterCoreFlag(java.util.List<? extends CmsPrincipal> 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<CmsGroup> |
filterCoreGroups(java.util.List<CmsGroup> groups)
Filters out all groups with flags greater than
. |
static java.util.List<CmsUser> |
filterCoreUsers(java.util.List<CmsUser> users)
Filters out all users with flags greater than
. |
static java.util.List<? extends CmsPrincipal> |
filterFlag(java.util.List<? extends CmsPrincipal> 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.
|
java.lang.String |
getDisplayName(CmsObject cms,
java.util.Locale locale,
I_CmsGroupNameTranslation translation)
Returns the translated display name of this principal if it is a group and the display name otherwise.
|
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.
|
static java.lang.String |
getType(I_CmsPrincipal principal)
Gets the type of a principal.
|
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 name)
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.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitcheckName, getDescriptionprotected java.lang.String m_description
protected int m_flags
protected java.lang.String m_name
protected CmsPrincipal()
public static java.util.List<? extends CmsPrincipal> filterCoreFlag(java.util.List<? extends CmsPrincipal> 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 filteringpublic static java.util.List<CmsGroup> filterCoreGroups(java.util.List<CmsGroup> groups)
I_CmsPrincipal.FLAG_CORE_LIMIT.The given parameter list is directly modified, so the returned list is the same object as the input list.
groups - a list of CmsGroup objectspublic static java.util.List<CmsUser> filterCoreUsers(java.util.List<CmsUser> users)
I_CmsPrincipal.FLAG_CORE_LIMIT.The given parameter list is directly modified, so the returned list is the same object as the input list.
users - a list of CmsUser objectspublic static java.util.List<? extends CmsPrincipal> filterFlag(java.util.List<? extends CmsPrincipal> 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 filteringpublic static java.lang.String getPrefixedGroup(java.lang.String name)
I_CmsPrincipal.PRINCIPAL_GROUP..name - the name to add the prefix toI_CmsPrincipal.PRINCIPAL_GROUP.public static java.lang.String getPrefixedUser(java.lang.String name)
I_CmsPrincipal.PRINCIPAL_USER..name - the name to add the prefix toI_CmsPrincipal.PRINCIPAL_USER.public static java.lang.String getType(I_CmsPrincipal principal)
principal - the principalpublic 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 nameCmsException - 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 readCmsException - in case the principal could not be readpublic static I_CmsPrincipal readPrincipal(CmsObject cms, java.lang.String name) throws CmsException
cms - the OpenCms user context to use when reading the principalname - the name of the principal to readCmsException - 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 nameCmsException - 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 readCmsException - in case the principal could not be readpublic int compareTo(I_CmsPrincipal obj)
compareTo in interface java.lang.Comparable<I_CmsPrincipal>Comparable.compareTo(java.lang.Object)public boolean equals(java.lang.Object obj)
I_CmsPrincipalequals in interface java.security.Principalequals in interface I_CmsPrincipalequals in class java.lang.Objectobj - object to compareObject.equals(java.lang.Object)public java.lang.String getDescription()
I_CmsPrincipalgetDescription in interface I_CmsPrincipalI_CmsPrincipal.getDescription()public java.lang.String getDisplayName(CmsObject cms, java.util.Locale locale) throws CmsException
cms - the cms contextlocale - the localeCmsException - if the organizational unit could not be readpublic java.lang.String getDisplayName(CmsObject cms, java.util.Locale locale, I_CmsGroupNameTranslation translation) throws CmsException
cms - the current CMS contextlocale - the localetranslation - the group name translation to useCmsException - if something goes wrongpublic 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_CmsPrincipalI_CmsPrincipal.getFlags()public CmsUUID getId()
I_CmsPrincipalgetId in interface I_CmsPrincipalI_CmsPrincipal.getId()public java.lang.String getName()
getName in interface java.security.PrincipalgetName in interface I_CmsPrincipalPrincipal.getName()public java.lang.String getOuFqn()
getOuFqn in interface I_CmsPrincipalpublic 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_CmsPrincipalI_CmsPrincipal.getPrefixedName()public java.lang.String getSimpleName()
getSimpleName in interface I_CmsPrincipalpublic int hashCode()
I_CmsPrincipalhashCode in interface java.security.PrincipalhashCode in interface I_CmsPrincipalhashCode in class java.lang.ObjectObject.hashCode()public boolean isEnabled()
I_CmsPrincipaltrue 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_CmsPrincipaltrue if this principal is enabledI_CmsPrincipal.isEnabled()public boolean isGroup()
I_CmsPrincipaltrue if this principal is of type CmsGroup.isGroup in interface I_CmsPrincipaltrue if this principal is of type CmsGroupI_CmsPrincipal.isGroup()public boolean isUser()
I_CmsPrincipaltrue if this principal is of type CmsUser.isUser in interface I_CmsPrincipaltrue if this principal is of type CmsUserI_CmsPrincipal.isUser()public void setDescription(java.lang.String description)
I_CmsPrincipalsetDescription in interface I_CmsPrincipaldescription - the principal description to setI_CmsPrincipal.setDescription(java.lang.String)public void setEnabled(boolean enabled)
I_CmsPrincipalsetEnabled in interface I_CmsPrincipalenabled - 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_CmsPrincipalvalue - the value to set this principals flags toI_CmsPrincipal.setFlags(int)public void setName(java.lang.String name)
I_CmsPrincipalsetName in interface I_CmsPrincipalname - the unique name of this principal to setI_CmsPrincipal.setName(java.lang.String)