| 
 | ||||||||
| 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  String | m_descriptionThe description of this principal. | 
| protected  int | m_flagsThe flags of this principal. | 
| protected  CmsUUID | m_idThe unique id of this principal. | 
| protected  String | m_nameThe 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(I_CmsPrincipal obj) | 
|  boolean | equals(Object obj)Compares the given object with this principal. | 
| static List<? extends CmsPrincipal> | filterCoreFlag(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 List<CmsGroup> | filterCoreGroups(List<CmsGroup> groups)Filters out all groups with flags greater than . | 
| static List<CmsUser> | filterCoreUsers(List<CmsUser> users)Filters out all users with flags greater than . | 
| static List<? extends CmsPrincipal> | filterFlag(List<? extends CmsPrincipal> principals,
           int flag)Filters out all principals that do not have the given flag set. | 
|  String | getDescription()Returns the description of this principal. | 
|  String | getDisplayName(CmsObject cms,
               Locale locale)Returns the display name of this principal including the organizational unit. | 
|  String | getDisplayName(CmsObject cms,
               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. | 
|  String | getName()Returns the fully qualified name of this principal. | 
|  String | getOuFqn()Returns the fully qualified name of the associated organizational unit. | 
| static String | getPrefixedGroup(String name)Returns the provided group name prefixed with . | 
|  String | getPrefixedName()Returns this principals unique name prefixed with it's type. | 
| static String | getPrefixedUser(String name)Returns the provided user name prefixed with . | 
|  String | getSimpleName()Returns the simple name of this organizational unit. | 
|  int | hashCode()Returns the hash code of this object. | 
|  boolean | isEnabled()Returns trueif this principal is enabled. | 
|  boolean | isGroup()Returns trueif this principal is of type. | 
|  boolean | isUser()Returns trueif this principal is of type. | 
| static I_CmsPrincipal | readPrefixedPrincipal(CmsObject cms,
                      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,
              String type,
              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(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(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 String m_description
protected int m_flags
protected CmsUUID m_id
protected String m_name
| Constructor Detail | 
|---|
protected CmsPrincipal()
| Method Detail | 
|---|
public static List<? extends CmsPrincipal> filterCoreFlag(List<? extends CmsPrincipal> principals,
                                                          int flag)
I_CmsPrincipal.FLAG_CORE_LIMITThe given parameter list is directly modified, so the returned list is the same object as the input list.
principals - a list of CmsPrincipalflag - the flag for filtering
public static List<CmsGroup> filterCoreGroups(List<CmsGroup> groups)
I_CmsPrincipal.FLAG_CORE_LIMITThe given parameter list is directly modified, so the returned list is the same object as the input list.
groups - a list of CmsGrouppublic static List<CmsUser> filterCoreUsers(List<CmsUser> users)
I_CmsPrincipal.FLAG_CORE_LIMITThe given parameter list is directly modified, so the returned list is the same object as the input list.
users - a list of CmsUser
public static List<? extends CmsPrincipal> filterFlag(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 CmsPrincipalflag - the flag for filtering
public static String getPrefixedGroup(String name)
I_CmsPrincipal.PRINCIPAL_GROUP.
name - the name to add the prefix to
I_CmsPrincipal.PRINCIPAL_GROUP.public static String getPrefixedUser(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,
                                                   String name)
                                            throws CmsException
 
 The principal must be either prefixed with 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 read
public 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 read
public static I_CmsPrincipal readPrincipal(CmsObject cms,
                                           String type,
                                           String name)
                                    throws CmsException
 
 The type must either be I_CmsPrincipal.PRINCIPAL_GROUPI_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 read
public 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(I_CmsPrincipal obj)
compareTo in interface Comparable<I_CmsPrincipal>Comparable.compareTo(java.lang.Object)public boolean equals(Object obj)
I_CmsPrincipal
equals in interface Principalequals in interface I_CmsPrincipalequals in class Objectobj - object to compare
Object.equals(java.lang.Object)public String getDescription()
I_CmsPrincipal
getDescription in interface I_CmsPrincipalI_CmsPrincipal.getDescription()
public String getDisplayName(CmsObject cms,
                             Locale locale)
                      throws CmsException
cms - the cms contextlocale - the locale
CmsException - if the organizational unit could not be read
public String getDisplayName(CmsObject cms,
                             Locale locale,
                             I_CmsGroupNameTranslation translation)
                      throws CmsException
cms - the current CMS contextlocale - the localetranslation - the group name translation to use
CmsException - 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 I_CmsPrincipal.isEnabled()
getFlags in interface I_CmsPrincipalI_CmsPrincipal.getFlags()public CmsUUID getId()
I_CmsPrincipal
getId in interface I_CmsPrincipalI_CmsPrincipal.getId()public String getName()
getName in interface PrincipalgetName in interface I_CmsPrincipalPrincipal.getName()public String getOuFqn()
getOuFqn in interface I_CmsPrincipalpublic String getPrefixedName()
I_CmsPrincipal
 
 The type prefix can either be I_CmsPrincipal.PRINCIPAL_GROUP.I_CmsPrincipal.PRINCIPAL_USER.
getPrefixedName in interface I_CmsPrincipalI_CmsPrincipal.getPrefixedName()public String getSimpleName()
getSimpleName in interface I_CmsPrincipalpublic int hashCode()
I_CmsPrincipal
hashCode in interface PrincipalhashCode in interface I_CmsPrincipalhashCode in class 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(String description)
I_CmsPrincipal
setDescription in interface I_CmsPrincipaldescription - the principal description to setI_CmsPrincipal.setDescription(java.lang.String)public void setEnabled(boolean enabled)
I_CmsPrincipal
setEnabled 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 I_CmsPrincipal.setEnabled(boolean)
setFlags in interface I_CmsPrincipalvalue - the value to set this principals flags toI_CmsPrincipal.setFlags(int)public void setName(String name)
I_CmsPrincipal
setName in interface I_CmsPrincipalname - 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 | |||||||