Package org.ametys.cms.rights
Class CheckReadAccessAction
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.acting.AbstractAction
org.apache.cocoon.acting.ServiceableAction
org.ametys.cms.rights.CheckReadAccessAction
- All Implemented Interfaces:
Component,LogEnabled,Serviceable,Action
- Direct Known Subclasses:
CheckPageReadAccessAction,CheckReadAccessAction,CheckSitemapReadAccessAction
Test if the accessed object is not restricted, i.e. an anonymous user has READ access
or if the connected user has READ access on it.
- If the object is not restricted, returns EMPTY_MAP.
- If the object is restricted and the current user is allowed, return null.
- If the object is restricted but the current user is not allowed, an
AccessDeniedExceptionis thrown. - If the object is restricted but no one is logged in, an
AuthorizationRequiredExceptionis thrown.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CurrentUserProviderThe current user providerprotected AmetysObjectResolverThe Ametys object resolver.protected RightManagerThe right managerFields inherited from class org.apache.cocoon.acting.ServiceableAction
managerFields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionact(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) protected AmetysObjectgetAmetysObject(Parameters parameters, Request request) Get the Ametys object from either the parameters or the request attributes.voidservice(ServiceManager serviceManager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
_resolver
The Ametys object resolver. -
_currentUserProvider
The current user provider -
_rightManager
The right manager
-
-
Constructor Details
-
CheckReadAccessAction
public CheckReadAccessAction()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classServiceableAction- Throws:
ServiceException
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception - Throws:
Exception
-
getAmetysObject
protected AmetysObject getAmetysObject(Parameters parameters, Request request) throws UnsupportedEncodingException Get the Ametys object from either the parameters or the request attributes.- Parameters:
parameters- the action parameters.request- the request.- Returns:
- the Ametys object or null if not found.
- Throws:
UnsupportedEncodingException- if failed to decode object path
-