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
AccessDeniedException
is thrown. - If the object is restricted but no one is logged in, an
AuthorizationRequiredException
is thrown.
-
Field Summary
Modifier and TypeFieldDescriptionprotected CurrentUserProvider
The current user providerprotected AmetysObjectResolver
The Ametys object resolver.protected RightManager
The right managerFields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionact
(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) protected AmetysObject
getAmetysObject
(Parameters parameters, Request request) Get the Ametys object from either the parameters or the request attributes.void
service
(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:
service
in interfaceServiceable
- Overrides:
service
in 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
-