Package com.jalios.jcms.accesscontrol
Class AccessControlUtil
- java.lang.Object
-
- com.jalios.jcms.accesscontrol.AccessControlUtil
-
- All Implemented Interfaces:
AccessControlConstants
public class AccessControlUtil extends java.lang.Object implements AccessControlConstants
Utility methods used for Access Control related operation.- Since:
- jcms-7.0
- Version:
- $Revision: 107554 $
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
REVISION
-
Fields inherited from interface com.jalios.jcms.accesscontrol.AccessControlConstants
ADMIN_RESOURCE, CTXT_DATA, CTXT_WORKSPACE, DBMBR_EDIT_RESOURCE, GRP_EDIT_RESOURCE, MBR_EDIT_RESOURCE, WORKSPACE_ADMIN_RESOURCE, WS_EDIT_RESOURCE, WSGRP_EDIT_RESOURCE, WSMBR_EDIT_RESOURCE
-
-
Constructor Summary
Constructors Constructor Description AccessControlUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
countMatches(java.lang.String str, java.lang.String sub)
static java.util.Map<java.lang.String,java.lang.Object>
getContext(Workspace workspace, java.lang.Object... keyValuePairs)
Retrieve a new context Map suitable for parameter in AccessControlManager access check.static java.util.LinkedHashMap<java.lang.String,java.lang.Integer>
getOrderedResourcesAndLevelMap()
Retrieve a Map of all resources with their corresponding hierarchy level.static java.lang.String
getParentResource(java.lang.String resource)
Retrieve the parent resource of the specified resource.static boolean
isAdminResource(java.lang.String resource)
Check if the specified resource is an administration resource.static boolean
isDataResource(java.lang.String resource)
Check if the specified resource is a resource related to edition of any Data.static boolean
isWorkspaceAdminResource(java.lang.String resource)
Check if the specified resource is a workspace resource.
-
-
-
Field Detail
-
REVISION
public static final java.lang.String REVISION
- See Also:
- Constant Field Values
-
-
Method Detail
-
isDataResource
public static boolean isDataResource(java.lang.String resource)
Check if the specified resource is a resource related to edition of any Data.- Parameters:
resource
- the resource id- Returns:
- true if this is a data resource, false for any other resource
- Since:
- jcms-7.0.0
-
isAdminResource
public static boolean isAdminResource(java.lang.String resource)
Check if the specified resource is an administration resource.- Parameters:
resource
- the resource id- Returns:
- true if this is a administration resource, false for any other resource
- Since:
- jcms-7.0.0
-
isWorkspaceAdminResource
public static boolean isWorkspaceAdminResource(java.lang.String resource)
Check if the specified resource is a workspace resource.- Parameters:
resource
- the resource id- Returns:
- true if this is a workspace resource, false for any other resource
- Since:
- jcms-7.0.0
-
getOrderedResourcesAndLevelMap
public static java.util.LinkedHashMap<java.lang.String,java.lang.Integer> getOrderedResourcesAndLevelMap()
Retrieve a Map of all resources with their corresponding hierarchy level.The Map is sorted so that iterating it can provide a complete and valid resource tree.
For example :
admin -> 0, admin/dev -> 1, admin/dev/store-cleaner -> 2, admin/dev/types -> 2, admin/users -> 1, admin/users/member -> 2, ...
- Since:
- jcms-7.0.0
-
countMatches
public static int countMatches(java.lang.String str, java.lang.String sub)
-
getContext
public static java.util.Map<java.lang.String,java.lang.Object> getContext(Workspace workspace, java.lang.Object... keyValuePairs)
Retrieve a new context Map suitable for parameter in AccessControlManager access check.- Parameters:
workspace
- the current workspacekeyValuePairs
- an even number of argument corresponding to key/pair to put in the map- Returns:
- a new HashMap
- Since:
- jcms-7.0.0
- See Also:
AccessControlManager.checkAccess(com.jalios.jcms.Member, String, Map)
-
getParentResource
public static java.lang.String getParentResource(java.lang.String resource)
Retrieve the parent resource of the specified resource.- Parameters:
resource
- a resource URI, seperated with slash, eg "admin/dev/store-cleaner"- Returns:
- the parent resource eg "admin/dev/"
- Since:
- jcms-7.0.0
-
-