Class OdfProgramRestrictionManager
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.odfweb.restrictions.OdfProgramRestrictionManager
- All Implemented Interfaces:
LogEnabled
,Disposable
,Component
,Contextualizable
,Serviceable
public class OdfProgramRestrictionManager
extends AbstractLogEnabled
implements Component, Serviceable, Contextualizable, Disposable
Component able to handle program restrictions related to the "odf-restrictions" site parameter.
-
Field Summary
Modifier and TypeFieldDescriptionprotected Context
Cocoon contextprotected ContentTypeExtensionPoint
The content type extension point.protected AmetysObjectResolver
Ametys object resolverprotected Map<String,
OdfProgramRestriction> The available odf restrictionsprotected RootOrgUnitProvider
Root orgunit providerprotected SiteManager
Site Managerstatic final String
The avalon role. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected OdfRestrictionRule
_configureRestrictionRule
(Configuration ruleConf) Configure a restriction rule from a configuration nodeprotected List<OdfRestrictionRule>
_configureRestrictionRules
(Configuration rulesConf) Create a list of rules from configuration nodesprotected void
Configured the restrictions from the XML configuration filevoid
contextualize
(Context context) void
dispose()
getRestriction
(Page odfRootPage) Get the ODF restriction for the given ODF root pagegetRestrictionRootOrgUnitId
(String siteName) Get the id of the restriction root orgunitRetrieves the available restrictionsboolean
hasOrgunitRestrictions
(Page rootPage) Indicate is there is any restriction related to orgunit for this root pageboolean
hasRestrictions
(Page rootPage) Indicate is there is any restriction for this root pagevoid
service
(ServiceManager serviceManager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The avalon role. -
_siteManager
Site Manager -
_cTypeEP
The content type extension point. -
_resolver
Ametys object resolver -
_rootOrgUnitProvider
Root orgunit provider -
_cocoonContext
Cocoon context -
_restrictions
The available odf restrictions
-
-
Constructor Details
-
OdfProgramRestrictionManager
public OdfProgramRestrictionManager()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
dispose
- Specified by:
dispose
in interfaceDisposable
-
getRestrictions
Retrieves the available restrictions- Returns:
- The map of restriction, where keys are restriction ids.
-
getRestriction
Get the ODF restriction for the given ODF root page- Parameters:
odfRootPage
- The ODF root page- Returns:
- The restriction or
null
-
hasRestrictions
Indicate is there is any restriction for this root page- Parameters:
rootPage
- odf root page- Returns:
- true if it is the case
-
hasOrgunitRestrictions
Indicate is there is any restriction related to orgunit for this root page- Parameters:
rootPage
- odf root page- Returns:
- true if it is the case
-
getRestrictionRootOrgUnitId
Get the id of the restriction root orgunit- Parameters:
siteName
- the site name- Returns:
- the id of the restriction root orgunit
-
_readRestrictionConfigurationFile
Configured the restrictions from the XML configuration file -
_configureRestrictionRules
protected List<OdfRestrictionRule> _configureRestrictionRules(Configuration rulesConf) throws ConfigurationException Create a list of rules from configuration nodes- Parameters:
rulesConf
- Array of configuration node that represents the set of rules- Returns:
- list of rules
- Throws:
ConfigurationException
- if a configuration error is encountered
-
_configureRestrictionRule
protected OdfRestrictionRule _configureRestrictionRule(Configuration ruleConf) throws ConfigurationException Configure a restriction rule from a configuration node- Parameters:
ruleConf
- The configuration node representing the rule- Returns:
- The odf restriction rule
- Throws:
ConfigurationException
- if a configuration error is encountered
-