|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.security.CmsRole
A role is used in the OpenCms security system to check if a user has access to a certain system function.
Roles are used to ensure access permissions to system function that are not file based.
For example, roles are used to check permissions to functions like "the user can schedule a
job in the
" or "the user can export (or import)
the OpenCms database".CmsScheduleManager
All roles are based on
. This means to have access to a role,
the user has to be a member in a certain predefined system group. Each role has exactly one group that
contains all "direct" members of this role.CmsGroup
All roles have (optional) parent roles. If a user not a member of the role group of a role, but he is a member of at last one of the parent role groups, he/she also has full access to this role. This is called "indirect" membership to the role.
Please note that "indirect" membership does grant the user the same full access to a role that "direct"
membership does. For example, the
role is a parent group of all other roles.
So all users that are members of ADMINISTRATOR
have access to the functions of all other roles.ADMINISTRATOR
Please do not perform automated sorting of members on this compilation unit. That leads to NPE's
Field Summary | |
static CmsRole |
ACCOUNT_MANAGER
The "ACCOUNT_MANAGER" role. |
static CmsRole |
ADMINISTRATOR
The "ADMINISTRATOR" role, which is a parent to all other roles. |
static CmsRole |
DEVELOPER
The "DEVELOPER" role. |
static CmsRole |
EXPORT_DATABASE
The "EXPORT_DATABASE" role. |
static CmsRole |
HISTORY_MANAGER
The "HISTORY_MANAGER" role. |
static CmsRole |
IMPORT_DATABASE
The "IMPORT_DATABASE" role. |
static CmsRole |
MODULE_MANAGER
The "MODULE_MANAGER" role. |
static CmsRole |
PROJECT_MANAGER
The "PROJECT_MANAGER" role. |
static CmsRole |
PROPERTY_MANAGER
The "PROPERTY_MANAGER" role. |
static CmsRole |
RESOURCE_TYPE_MANAGER
The "RESOURCE_TYPE_MANAGER" role. |
static CmsRole |
ROOT_FOLDER_ACCESS
The "ROOT_FOLDER_ACCESS" role. |
static CmsRole |
SCHEDULER_MANAGER
The "SCHEDULER_MANAGER" role. |
static CmsRole |
SEARCH_MANAGER
The "SEARCH_MANAGER" role. |
static CmsRole |
SYSTEM_USER
The "SYSTEM_USER" role. |
static CmsRole |
VFS_MANAGER
The "VFS_MANAGER" role. |
static CmsRole |
WORKPLACE_MANAGER
The "WORKPLACE_MANAGER" role. |
static CmsRole |
WORKPLACE_USER
The "WORKPLACE_USER" role. |
Constructor Summary | |
CmsRole(java.lang.String roleName,
java.lang.String groupName,
CmsRole[] parentRoles)
Creates a user defined role. |
Method Summary | |
boolean |
checkDirectAccess(java.util.List groups)
Returns true if the role group of this role (not the groups from the parent roles)
matches a name of one of the given groups. |
CmsRoleViolationException |
createRoleViolationException(CmsRequestContext context)
Returns a role violation exception configured with a localized, role specific message for this role. |
boolean |
equals(java.lang.Object obj)
|
java.lang.String |
getGroupName()
Returns the name of the group this role is mapped to in the OpenCms database. |
java.util.List |
getParentRoles()
Returns the (unmodifialble) List of parent roles of this role (instances of . |
java.lang.String |
getRoleName()
Returns the name of the role. |
static java.util.List |
getSystemRoles()
Returns the list of system defined roles (instances of ). |
int |
hashCode()
|
boolean |
hasRole(java.util.List groups)
Returns true if at last one of the given instances is
equal to a group of this role. |
boolean |
hasRole(java.lang.String[] groupNames)
Returns true if at last one of the given group names is equal to a group name
of this role. |
static void |
initialize(CmsDefaultUsers defaultUsers)
Initializes the system roles with the configured OpenCms system group names. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final CmsRole ADMINISTRATOR
public static final CmsRole DEVELOPER
public static final CmsRole EXPORT_DATABASE
public static final CmsRole HISTORY_MANAGER
public static final CmsRole IMPORT_DATABASE
public static final CmsRole MODULE_MANAGER
public static final CmsRole PROJECT_MANAGER
public static final CmsRole PROPERTY_MANAGER
public static final CmsRole RESOURCE_TYPE_MANAGER
Additional parent:
.MODULE_MANAGER
public static final CmsRole ROOT_FOLDER_ACCESS
public static final CmsRole SCHEDULER_MANAGER
public static final CmsRole SEARCH_MANAGER
public static final CmsRole ACCOUNT_MANAGER
public static final CmsRole VFS_MANAGER
public static final CmsRole WORKPLACE_MANAGER
Additional parents:
, MODULE_MANAGER
.DEVELOPER
public static final CmsRole WORKPLACE_USER
public static final CmsRole SYSTEM_USER
Additional parents:
, WORKPLACE_USER
PROJECT_MANAGER
,
.DEVELOPER
Constructor Detail |
public CmsRole(java.lang.String roleName, java.lang.String groupName, CmsRole[] parentRoles)
roleName
- the name of this rolegroupName
- the name of the group the members of this role are stored inparentRoles
- the parent roles of this roleMethod Detail |
public static java.util.List getSystemRoles()
CmsRole
).
public static void initialize(CmsDefaultUsers defaultUsers) throws CmsSecurityException
This is done automatically during the system startup phase, any manual calls later will result in an Exception.
defaultUsers
- the OpenCms default users
CmsSecurityException
- if called outside the system startup phasepublic boolean checkDirectAccess(java.util.List groups)
true
if the role group of this role (not the groups from the parent roles)
matches a name of one of the given groups.
This check is required only to find out if a user is a direct member of the role group of
this role. It should never be used for permission checks. For all permission checks, use
.hasRole(List)
groups
- a List of CmsGroup
instances to match this role group against
true
if the role group of this role (not the groups from the parent roles)
matches a name of one of the given groupspublic CmsRoleViolationException createRoleViolationException(CmsRequestContext context)
context
- the current users OpenCms request context
public boolean equals(java.lang.Object obj)
Object.equals(java.lang.Object)
public java.lang.String getGroupName()
public java.util.List getParentRoles()
CmsRole
.
public java.lang.String getRoleName()
public int hashCode()
Object.hashCode()
public boolean hasRole(java.util.List groups)
true
if at last one of the given CmsGroup
instances is
equal to a group of this role.This checks the given list against the role group of this role as well as against the role group of all parent roles.
groups
- a List of CmsGroup
instances to match the role groups against
true
if at last one of the given group names is equal to a group name
of this rolepublic boolean hasRole(java.lang.String[] groupNames)
true
if at last one of the given group names is equal to a group name
of this role.This checks the given list against the role group of this role as well as against the role group of all parent roles.
groupNames
- the group names to match the role groups against
true
if at last one of the given group names is equal to a group name
of this rolepublic java.lang.String toString()
Object.toString()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |