Class StringHierarchicalAccessController
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.core.impl.right.AbstractProfileStorageBasedAccessController
org.ametys.plugins.core.impl.right.AbstractHierarchicalAccessController<String>
org.ametys.plugins.core.impl.right.StringHierarchicalAccessController
- All Implemented Interfaces:
AccessController
,LogEnabled
,Initializable
,Component
,Configurable
,Serviceable
- Direct Known Subclasses:
WebWorkspaceAccessController
,WorkspaceAccessController
public class StringHierarchicalAccessController
extends AbstractHierarchicalAccessController<String>
implements Configurable
This implementation will manage hierarchical string (parents separated by '/').
For example '/node1/node2/node3', will seek for rights on '/node1/node2/node3', if nothing is found will try on '/node1/node2', and finally on '/node1'.
Configurable with several <prefix>/myprefix</prefix>
If this AcessController is limited to a workspace (by the corresponding
RightAssignmentContext
), this should be specified
with a configuration <workspace> that is a negativable regexp of a workspace context (such as '/cms' or '!/admin')-
Nested Class Summary
Nested classes/interfaces inherited from class org.ametys.plugins.core.impl.right.AbstractProfileStorageBasedAccessController
AbstractProfileStorageBasedAccessController.CacheKind
Nested classes/interfaces inherited from interface org.ametys.core.right.AccessController
AccessController.AccessResult
-
Field Summary
Modifier and TypeFieldDescriptionThe prefixesprotected boolean
Consider _workspaceMatcher negativelyprotected Pattern
The regexp that should match current workspaceprotected static final char
The separator characterFields inherited from class org.ametys.plugins.core.impl.right.AbstractProfileStorageBasedAccessController
__ANONYMOUS_USER_IDENTITY, __ANY_CONTECTED_USER_IDENTITY, _cacheManager, _profileAssignmentStorageEP, _rightProfileDAO
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_convertWorkspaceToRootRightContexts
(Set<Object> workspacesContexts) Get the current workspaces contexts and turn it into root contexts in order to allow methods hasXXXAnyPermissionOnWorkspace to work_getParents
(String object) Gets the parents of the object.void
configure
(Configuration configuration) Get the prefix of the path acceptedGet the prefix of the path acceptedboolean
isSupported
(Object object) Returns true if this access controller supports the given objectMethods inherited from class org.ametys.plugins.core.impl.right.AbstractHierarchicalAccessController
_getPermission, _getPermissionByGroup, _getPermissionByUser, _getPermissionForAnonymous, _getPermissionForAnyConnectedUser, getPermissionByRight, isInheritanceDisallowed
Methods inherited from class org.ametys.plugins.core.impl.right.AbstractProfileStorageBasedAccessController
_convertContext, _hasRightResultInFirstCache, _hasRightResultInSecondCache, _putInFirstCache, _putInSecondCache, getPermission, getPermissionByGroup, getPermissionByUser, getPermissionForAnonymous, getPermissionForAnyConnectedUser, getReadAccessPermission, getReadAccessPermissionByGroup, getReadAccessPermissionByUser, getReadAccessPermissionForAnonymous, getReadAccessPermissionForAnyConnectedUser, hasAnonymousAnyPermissionOnWorkspace, hasAnonymousAnyReadAccessPermissionOnWorkspace, hasAnyConnectedUserAnyPermissionOnWorkspace, hasAnyConnectedUserAnyReadAccessPermissionOnWorkspace, hasUserAnyPermissionOnWorkspace, hasUserAnyReadAccessPermissionOnWorkspace, initialize, service
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
SEPARATOR
The separator character- See Also:
-
_prefixes
The prefixes -
_workspaceMatcher
The regexp that should match current workspace -
_reverseWorkspaceMather
Consider _workspaceMatcher negatively
-
-
Constructor Details
-
StringHierarchicalAccessController
public StringHierarchicalAccessController()
-
-
Method Details
-
configure
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
getSupportedPrefixes
Get the prefix of the path accepted- Returns:
- The non-null and non-empty prefixes, starting by '/'
-
getRootPrefixes
Get the prefix of the path accepted- Returns:
- The non-null and non-empty prefixes, starting by '/'
-
_convertWorkspaceToRootRightContexts
protected Set<? extends Object> _convertWorkspaceToRootRightContexts(Set<Object> workspacesContexts) Description copied from class:AbstractProfileStorageBasedAccessController
Get the current workspaces contexts and turn it into root contexts in order to allow methods hasXXXAnyPermissionOnWorkspace to work- Specified by:
_convertWorkspaceToRootRightContexts
in classAbstractProfileStorageBasedAccessController
- Parameters:
workspacesContexts
- The workspace contexts. Such as '/${WorkspaceName}', '/admin'- Returns:
- A null or empty set if the current AccessController does not apply to any workspace context, or the root object where ProfileAssignmentStorageExtension should start looking at to find any permission
-
isSupported
Description copied from interface:AccessController
Returns true if this access controller supports the given object- Specified by:
isSupported
in interfaceAccessController
- Parameters:
object
- The object to test- Returns:
- true if this access controller supports the given object
-
_getParents
Description copied from class:AbstractHierarchicalAccessController
Gets the parents of the object. Must return null when the object is the "root" (where "root" means here the root of the hierarchy of the access controller)- Specified by:
_getParents
in classAbstractHierarchicalAccessController<String>
- Parameters:
object
- The object- Returns:
- the parents of the object, or null if the object is the "root" of the hierarchy
-