Class ContentRestrictedModelItemHelper
java.lang.Object
org.ametys.cms.model.restrictions.ContentRestrictedModelItemHelper
- All Implemented Interfaces:
Component
,Serviceable
Helper for definitions with restrictions on contents
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_parseRestrictions
(Configuration configuration) Parses the attribute definition's restrictions.boolean
canRead
(Content content, ModelItem item, Restrictions restrictions) Determine whether a model item can be read at this time.boolean
canWrite
(Content content, ModelItem item, Restrictions restrictions) Determine whether a model item can be written at this time.void
service
(ServiceManager manager)
-
Field Details
-
ROLE
The Avalon role name
-
-
Constructor Details
-
ContentRestrictedModelItemHelper
public ContentRestrictedModelItemHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
canRead
public boolean canRead(Content content, ModelItem item, Restrictions restrictions) throws AmetysRepositoryException Determine whether a model item can be read at this time.- Parameters:
item
- the model item on which check the restrictionscontent
- The content where item is to be written on. Can be null, on content creation.restrictions
- the restrictions to check- Returns:
true
if the current user is allowed to write the model item of this content.- Throws:
AmetysRepositoryException
- if an error occurs while accessing the content workflow.
-
canWrite
public boolean canWrite(Content content, ModelItem item, Restrictions restrictions) throws AmetysRepositoryException Determine whether a model item can be written at this time.- Parameters:
item
- the model item on which check the restrictionscontent
- The content where item is to be written on. Can be null, on content creation.restrictions
- the restrictions to check- Returns:
true
if the current user is allowed to write the model item of this content.- Throws:
AmetysRepositoryException
- if an error occurs while accessing the content workflow.
-
_parseRestrictions
Parses the attribute definition's restrictions.- Parameters:
configuration
- the configuration of the element that have content restrictions- Returns:
- the parsed restrictions.
- Throws:
ConfigurationException
- if the configuration is not valid.
-