Package org.opencms.file
Class CmsGroup
- java.lang.Object
-
- org.opencms.security.CmsPrincipal
-
- org.opencms.file.CmsGroup
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<I_CmsPrincipal>
,java.security.Principal
,I_CmsPrincipal
public class CmsGroup extends CmsPrincipal
A group principal in the OpenCms permission system.- Since:
- 6.0.0
- See Also:
CmsUser
, Serialized Form
-
-
Field Summary
-
Fields inherited from class org.opencms.security.CmsPrincipal
m_description, m_flags, m_id, m_name
-
Fields inherited from interface org.opencms.security.I_CmsPrincipal
FLAG_CORE_LIMIT, FLAG_DISABLED, FLAG_ENABLED, FLAG_GROUP_ROLE, FLAG_GROUP_VIRTUAL, FLAG_USER_MANAGED, FLAG_USER_WEBUSER, PRINCIPAL_GROUP, PRINCIPAL_USER
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkName(java.lang.String name)
Checks if the provided group name is valid and can be used as an argument value forCmsPrincipal.setName(String)
.java.lang.Object
clone()
java.lang.String
getDescription(java.util.Locale locale)
Returns the description of this organizational unit.CmsUUID
getParentId()
Returns the parent group id of this group.static boolean
hasPrefix(java.lang.String principalName)
Checks if the given String starts withI_CmsPrincipal.PRINCIPAL_GROUP
followed by a dot.boolean
isGroup()
Returnstrue
if this principal is of type
.CmsGroup
boolean
isRole()
Checks if this group is a role group.boolean
isUser()
Returnstrue
if this principal is of type
.CmsUser
boolean
isVirtual()
Checks if this group is a virtual group, emulating a role.static java.lang.String
removePrefix(java.lang.String principalName)
Removes the prefix if the given String starts withI_CmsPrincipal.PRINCIPAL_GROUP
followed by a dot.void
setParentId(CmsUUID parentId)
Sets the parent group id of this group.java.lang.String
toString()
-
Methods inherited from class org.opencms.security.CmsPrincipal
compareTo, equals, filterCoreFlag, filterCoreGroups, filterCoreUsers, filterFlag, getDescription, getDisplayName, getDisplayName, getFlags, getId, getName, getOuFqn, getPrefixedGroup, getPrefixedName, getPrefixedUser, getSimpleName, getType, hashCode, isEnabled, readPrefixedPrincipal, readPrincipal, readPrincipal, readPrincipal, readPrincipalIncludingHistory, setDescription, setEnabled, setFlags, setName
-
-
-
-
Constructor Detail
-
CmsGroup
public CmsGroup()
Creates a new, empty OpenCms group principal.
-
CmsGroup
public CmsGroup(CmsUUID id, CmsUUID parentId, java.lang.String name, java.lang.String description, int flags)
Creates a new OpenCms group principal.- Parameters:
id
- the unique id of the groupparentId
- the is of the parent groupname
- the fully qualified name of the name of the groupdescription
- the description of the groupflags
- the flags of the group
-
-
Method Detail
-
hasPrefix
public static boolean hasPrefix(java.lang.String principalName)
Checks if the given String starts withI_CmsPrincipal.PRINCIPAL_GROUP
followed by a dot.- Works if the given String is
null
. - Removes white spaces around the String before the check.
- Also works with prefixes not being in upper case.
- Does not check if the group after the prefix actually exists.
- Parameters:
principalName
- the group name to check- Returns:
true
in case the String starts withI_CmsPrincipal.PRINCIPAL_GROUP
- Works if the given String is
-
removePrefix
public static java.lang.String removePrefix(java.lang.String principalName)
Removes the prefix if the given String starts withI_CmsPrincipal.PRINCIPAL_GROUP
followed by a dot.- Works if the given String is
null
. - If the given String does not start with
I_CmsPrincipal.PRINCIPAL_GROUP
followed by a dot it is returned unchanged. - Removes white spaces around the group name.
- Also works with prefixes not being in upper case.
- Does not check if the group after the prefix actually exists.
- Parameters:
principalName
- the group name to remove the prefix from- Returns:
- the given String with the prefix
I_CmsPrincipal.PRINCIPAL_GROUP
with the following dot removed
- Works if the given String is
-
checkName
public void checkName(java.lang.String name)
Checks if the provided group name is valid and can be used as an argument value forCmsPrincipal.setName(String)
.A group name must not be empty or whitespace only.
- Parameters:
name
- the group name to check- See Also:
I_CmsValidationHandler.checkGroupName(String)
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classjava.lang.Object
- See Also:
Object.clone()
-
getDescription
public java.lang.String getDescription(java.util.Locale locale)
Returns the description of this organizational unit.- Parameters:
locale
- the locale- Returns:
- the description of this organizational unit
-
getParentId
public CmsUUID getParentId()
Returns the parent group id of this group.- Returns:
- the parent group id of this group
-
isGroup
public boolean isGroup()
Description copied from interface:I_CmsPrincipal
Returnstrue
if this principal is of type
.CmsGroup
- Specified by:
isGroup
in interfaceI_CmsPrincipal
- Overrides:
isGroup
in classCmsPrincipal
- Returns:
true
if this principal is of typeCmsGroup
- See Also:
I_CmsPrincipal.isGroup()
-
isRole
public boolean isRole()
Checks if this group is a role group.- Returns:
true
if this group is a role group
-
isUser
public boolean isUser()
Description copied from interface:I_CmsPrincipal
Returnstrue
if this principal is of type
.CmsUser
- Specified by:
isUser
in interfaceI_CmsPrincipal
- Overrides:
isUser
in classCmsPrincipal
- Returns:
true
if this principal is of typeCmsUser
- See Also:
I_CmsPrincipal.isUser()
-
isVirtual
public boolean isVirtual()
Checks if this group is a virtual group, emulating a role.- Returns:
- if this group is a virtual group
-
setParentId
public void setParentId(CmsUUID parentId)
Sets the parent group id of this group.- Parameters:
parentId
- the parent group id to set
-
toString
public java.lang.String toString()
- Specified by:
toString
in interfacejava.security.Principal
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
-