Class ServiceRestrictionsImpl
- java.lang.Object
-
- com.composum.sling.core.service.impl.ServiceRestrictionsImpl
-
- All Implemented Interfaces:
ServiceRestrictions
public class ServiceRestrictionsImpl extends Object implements ServiceRestrictions
The service to restict the service operations and the Sling POST requests.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ServiceRestrictionsImpl.Config
-
Nested classes/interfaces inherited from interface com.composum.sling.core.service.ServiceRestrictions
ServiceRestrictions.Key, ServiceRestrictions.Permission, ServiceRestrictions.Restriction
-
-
Field Summary
-
Fields inherited from interface com.composum.sling.core.service.ServiceRestrictions
AUTHORIZABLE_RESTRICTION_PREFIX, SA_PERMISSION
-
-
Constructor Summary
Constructors Constructor Description ServiceRestrictionsImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
activate(org.osgi.framework.BundleContext bundleContext, ServiceRestrictionsImpl.Config config)
protected void
addRestriction(@NotNull String rule)
boolean
checkAuthorizables(@NotNull org.apache.sling.api.SlingHttpServletRequest request, @Nullable String restrictions)
Checks the restrictions for matching authorizable of the request id the restictions are 'authorizable' restrictions.@Nullable org.apache.jackrabbit.api.security.user.Authorizable
getAuthorizable(@NotNull org.apache.sling.api.SlingHttpServletRequest request)
ServiceRestrictions.Permission
getDefaultPermisson()
@NotNull ServiceRestrictions.Permission
getPermission(@Nullable ServiceRestrictions.Key key)
protected @NotNull ServiceRestrictions.Restriction
getRestriction(@NotNull ServiceRestrictions.Key key)
@Nullable String
getRestrictions(@Nullable ServiceRestrictions.Key key)
boolean
isPermissible(@Nullable org.apache.sling.api.SlingHttpServletRequest request, @Nullable ServiceRestrictions.Key key, @NotNull ServiceRestrictions.Permission needed)
boolean
isUserOptionAllowed(@NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull ServiceRestrictions.Permission permission)
-
-
-
Method Detail
-
activate
protected void activate(org.osgi.framework.BundleContext bundleContext, ServiceRestrictionsImpl.Config config)
-
isUserOptionAllowed
public boolean isUserOptionAllowed(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull @NotNull ServiceRestrictions.Permission permission)
- Specified by:
isUserOptionAllowed
in interfaceServiceRestrictions
-
getDefaultPermisson
public ServiceRestrictions.Permission getDefaultPermisson()
- Specified by:
getDefaultPermisson
in interfaceServiceRestrictions
-
addRestriction
protected void addRestriction(@NotNull @NotNull String rule)
-
getRestriction
@NotNull protected @NotNull ServiceRestrictions.Restriction getRestriction(@NotNull @NotNull ServiceRestrictions.Key key)
-
isPermissible
public boolean isPermissible(@Nullable @Nullable org.apache.sling.api.SlingHttpServletRequest request, @Nullable @Nullable ServiceRestrictions.Key key, @NotNull @NotNull ServiceRestrictions.Permission needed)
- Specified by:
isPermissible
in interfaceServiceRestrictions
-
getPermission
@NotNull public @NotNull ServiceRestrictions.Permission getPermission(@Nullable @Nullable ServiceRestrictions.Key key)
- Specified by:
getPermission
in interfaceServiceRestrictions
-
getRestrictions
@Nullable public @Nullable String getRestrictions(@Nullable @Nullable ServiceRestrictions.Key key)
- Specified by:
getRestrictions
in interfaceServiceRestrictions
-
getAuthorizable
@Nullable public @Nullable org.apache.jackrabbit.api.security.user.Authorizable getAuthorizable(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request)
-
checkAuthorizables
public boolean checkAuthorizables(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @Nullable @Nullable String restrictions)
Description copied from interface:ServiceRestrictions
Checks the restrictions for matching authorizable of the request id the restictions are 'authorizable' restrictions.- Specified by:
checkAuthorizables
in interfaceServiceRestrictions
- Parameters:
request
- the current request to retrieve the current authorizable (user)restrictions
- the restrictions pattern string to check- Returns:
-
-