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
public class CheckReadAccessAction extends ServiceableAction
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
Fields Modifier and Type Field Description protected CurrentUserProvider
_currentUserProvider
The current user providerprotected AmetysObjectResolver
_resolver
The Ametys object resolver.protected RightManager
_rightManager
The right manager-
Fields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
-
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
-
Constructor Summary
Constructors Constructor Description CheckReadAccessAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map
act(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 Detail
-
_resolver
protected AmetysObjectResolver _resolver
The Ametys object resolver.
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
_rightManager
protected RightManager _rightManager
The right manager
-
-
Constructor Detail
-
CheckReadAccessAction
public CheckReadAccessAction()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- 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
-
-