Class ContentRestrictedModelItemHelper

java.lang.Object
org.ametys.cms.model.restrictions.ContentRestrictedModelItemHelper
All Implemented Interfaces:
Component

public class ContentRestrictedModelItemHelper extends Object implements Component
Helper for definitions with restrictions on contents
  • Field Details

    • ROLE

      public static final String ROLE
      The Avalon role name
  • Constructor Details

  • Method Details

    • canRead

      public boolean canRead(Content content, RestrictedModelItem item) throws AmetysRepositoryException
      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

      public boolean canWrite(Content content, RestrictedModelItem item) throws AmetysRepositoryException
      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 name
      restrictedModelItem - the restricted model item
      attributeConfiguration - 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 model
      restrictionManager - the restrictions component manager.
      Throws:
      Exception - if an error occurs.