Class ContentRestrictedModelItemHelper
java.lang.Object
org.ametys.cms.model.restrictions.ContentRestrictedModelItemHelper
- All Implemented Interfaces:
Component
Helper for definitions with restrictions on contents
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canRead
(Content content, RestrictedModelItem item) Determine whether a model item can be read at this time.boolean
canWrite
(Content content, RestrictedModelItem item) Determine whether a model item can be written at this time.void
lookupRestrictions
(Model model, ThreadSafeComponentManager<Restriction> restrictionManager) Retrieves local restrictions components and set them into previously parsed element definition.void
parseAndSetRestriction
(String pluginName, RestrictedModelItem restrictedModelItem, Configuration attributeConfiguration, ThreadSafeComponentManager<Restriction> restrictionManager) Parses the attribute definition's restrictions.
-
Field Details
-
ROLE
The Avalon role name
-
-
Constructor Details
-
ContentRestrictedModelItemHelper
public ContentRestrictedModelItemHelper()
-
-
Method Details
-
canRead
Determine whether a model item can be read at this time.- Parameters:
content
- The content where item is to be written on. Can be null, on content creation.item
- the restricted model item on which check the restrictions- 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
Determine whether a model item can be written at this time.- Parameters:
content
- The content where item is to be written on. Can be null, on content creation.item
- the restricted model item on which check the restrictions- 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.
-
parseAndSetRestriction
public void parseAndSetRestriction(String pluginName, RestrictedModelItem restrictedModelItem, Configuration attributeConfiguration, ThreadSafeComponentManager<Restriction> restrictionManager) throws ConfigurationException Parses the attribute definition's restrictions.- Parameters:
pluginName
- the plugin namerestrictedModelItem
- the restricted model itemattributeConfiguration
- the attribute configuration to use.restrictionManager
- the restrictions component manager.- Throws:
ConfigurationException
- if the configuration is not valid.
-
lookupRestrictions
public void lookupRestrictions(Model model, ThreadSafeComponentManager<Restriction> restrictionManager) throws Exception Retrieves local restrictions components and set them into previously parsed element definition.- Parameters:
model
- the modelrestrictionManager
- the restrictions component manager.- Throws:
Exception
- if an error occurs.
-