@ConsumerType
public interface ResourceAccessGate
ResourceAccessGate
defines a service API which might be used
to make some restrictions to accessing resources.
Implementations of this service interface must be registered like
ResourceProvider with a path (like provider.roots). If different
ResourceAccessGateService services match a path, not only the
ResourceAccessGateService with the longest path will be called, but all of
them, that's in contrast to the ResourceProvider, but in this case more
logical (and secure!). The gates will be called in the order of the
service ranking.
If one of the gates grants access for a given operation access will be granted.
service properties:
GateResult.DONTCARE
PROVIDER_CONTEXT
,
in this case the gate is only applied to resource providers requesting the
security checks. Or the context can be APPLICATION_CONTEXT
. In this
case the access gate is invoked for the whole resource tree.
This is indicated by the required service property CONTEXT
. If the
property is missing or invalid, the service is ignored.Modifier and Type | Interface and Description |
---|---|
static class |
ResourceAccessGate.GateResult
GateResult defines 3 possible states which can be returned
by the different canXXX methods of this interface. |
static class |
ResourceAccessGate.Operation |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
APPLICATION_CONTEXT
Allowed value for the
CONTEXT service registration property. |
static java.lang.String |
CONTEXT
The name of the service registration property containing the context
of this service.
|
static java.lang.String |
FINALOPERATIONS
The name of the service registration property containing the operations
for which the service should be called and no further service should be
called after this, except the services returns DONTCARE as result,
default is empty (non of them are final) (value is "finaloperations").
|
static java.lang.String |
OPERATIONS
The name of the service registration property containing the operations
for which the service should be called, defaults to all the operations
(value is "operations").
|
static java.lang.String |
PATH
The name of the service registration property containing the path as a
regular expression for which the service should be called (value is
"path").
|
static java.lang.String |
PROVIDER_CONTEXT
Allowed value for the
CONTEXT service registration property. |
static java.lang.String |
SERVICE_NAME
The service name to use when registering implementations of this
interface as services (value is
"org.apache.sling.api.resource.ResourceAccessGate").
|
static final java.lang.String SERVICE_NAME
static final java.lang.String CONTEXT
APPLICATION_CONTEXT
and
PROVIDER_CONTEXT
.
This property is required and has no default value.
(value is "access.context")static final java.lang.String APPLICATION_CONTEXT
CONTEXT
service registration property.
Services marked with this context are applied to all resources.static final java.lang.String PROVIDER_CONTEXT
CONTEXT
service registration property.
Services marked with this context are only applied to resource
providers which indicate the additional checks with the
ResourceProvider.USE_RESOURCE_ACCESS_SECURITY
property.static final java.lang.String PATH
static final java.lang.String OPERATIONS
static final java.lang.String FINALOPERATIONS
ResourceAccessGate.GateResult canRead(Resource resource)
ResourceAccessGate.GateResult canCreate(java.lang.String absPathName, ResourceResolver resourceResolver)
ResourceAccessGate.GateResult canUpdate(Resource resource)
ResourceAccessGate.GateResult canDelete(Resource resource)
ResourceAccessGate.GateResult canExecute(Resource resource)
ResourceAccessGate.GateResult canReadValue(Resource resource, java.lang.String valueName)
ResourceAccessGate.GateResult canCreateValue(Resource resource, java.lang.String valueName)
ResourceAccessGate.GateResult canUpdateValue(Resource resource, java.lang.String valueName)
ResourceAccessGate.GateResult canDeleteValue(Resource resource, java.lang.String valueName)
java.lang.String transformQuery(java.lang.String query, java.lang.String language, ResourceResolver resourceResolver) throws AccessSecurityException
query
- the querylanguage
- the language in which the query is expressedresourceResolver
- the resource resolver which resolves the querynull
AccessSecurityException
boolean hasReadRestrictions(ResourceResolver resourceResolver)
boolean hasCreateRestrictions(ResourceResolver resourceResolver)
boolean hasUpdateRestrictions(ResourceResolver resourceResolver)
boolean hasDeleteRestrictions(ResourceResolver resourceResolver)
boolean hasExecuteRestrictions(ResourceResolver resourceResolver)
boolean canReadAllValues(Resource resource)
boolean canCreateAllValues(Resource resource)
boolean canUpdateAllValues(Resource resource)
boolean canDeleteAllValues(Resource resource)
Copyright © 2010 - 2020 Adobe. All Rights Reserved