Package org.alfresco.repo.node
Class CDDefinitionProtection
java.lang.Object
org.alfresco.repo.node.CDDefinitionProtection
- All Implemented Interfaces:
NodeServicePolicies.BeforeCreateNodePolicy,NodeServicePolicies.BeforeDeleteNodePolicy,NodeServicePolicies.BeforeMoveNodePolicy,NodeServicePolicies.BeforeSetNodeTypePolicy,NodeServicePolicies.BeforeUpdateNodePolicy,ClassPolicy,Policy
public class CDDefinitionProtection
extends Object
implements NodeServicePolicies.BeforeCreateNodePolicy, NodeServicePolicies.BeforeUpdateNodePolicy, NodeServicePolicies.BeforeDeleteNodePolicy, NodeServicePolicies.BeforeMoveNodePolicy, NodeServicePolicies.BeforeSetNodeTypePolicy
Behaviour bean that protects the Cascading Dictionary type (
cd:definition) from being created, updated, deleted, moved via the everyday Alfresco APIs (Node REST API, CMIS, WebDAV, scripts, …).
The goal is to catch accidental misuse, not to be a hardened sandbox. Power-user attacks via lower-level APIs are intentionally out of scope — they're not what a normal user does by mistake.
The CD subsystem opts out of these checks by surrounding its legitimate writes with behaviourFilter.disableBehaviour(ContentModel.TYPE_CD_DEFINITION), which silences the cd:definition-bound bindings.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.alfresco.repo.policy.Policy
Policy.Arg -
Field Summary
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeCreateNodePolicy
QNAMEFields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
QNAMEFields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeMoveNodePolicy
QNAMEFields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeSetNodeTypePolicy
QNAMEFields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeUpdateNodePolicy
QNAME -
Constructor Summary
ConstructorsConstructorDescriptionCDDefinitionProtection(PolicyComponent policyComponent, NamespaceService namespaceService) -
Method Summary
Modifier and TypeMethodDescriptionvoidbeforeCreateNode(NodeRef parentRef, QName assocTypeQName, QName assocQName, QName nodeTypeQName) Called before a new node is created.voidbeforeDeleteNode(NodeRef nodeRef) Called before a node is deleted.voidbeforeMoveNode(ChildAssociationRef oldChildAssocRef, NodeRef newParentRef) Called before a node is moved.voidbeforeSetNodeType(NodeRef nodeRef, QName oldType, QName newType) sys:basebinding — rejectssetType(node, cd:definition).voidbeforeUpdateNode(NodeRef nodeRef) Called before a node is updated.voidinit()
-
Constructor Details
-
CDDefinitionProtection
-
-
Method Details
-
init
public void init() -
beforeCreateNode
public void beforeCreateNode(NodeRef parentRef, QName assocTypeQName, QName assocQName, QName nodeTypeQName) Description copied from interface:NodeServicePolicies.BeforeCreateNodePolicyCalled before a new node is created.- Specified by:
beforeCreateNodein interfaceNodeServicePolicies.BeforeCreateNodePolicy- Parameters:
parentRef- the parent node referenceassocTypeQName- the association type qualified nameassocQName- the association qualified namenodeTypeQName- the node type qualified name
-
beforeUpdateNode
Description copied from interface:NodeServicePolicies.BeforeUpdateNodePolicyCalled before a node is updated. This includes the modification of properties, child and target associations and the addition of aspects.- Specified by:
beforeUpdateNodein interfaceNodeServicePolicies.BeforeUpdateNodePolicy- Parameters:
nodeRef- reference to the node being updated
-
beforeDeleteNode
Description copied from interface:NodeServicePolicies.BeforeDeleteNodePolicyCalled before a node is deleted.- Specified by:
beforeDeleteNodein interfaceNodeServicePolicies.BeforeDeleteNodePolicy- Parameters:
nodeRef- the node reference
-
beforeMoveNode
Description copied from interface:NodeServicePolicies.BeforeMoveNodePolicyCalled before a node is moved.- Specified by:
beforeMoveNodein interfaceNodeServicePolicies.BeforeMoveNodePolicy- Parameters:
oldChildAssocRef- the child association reference prior to the movenewParentRef- the new parent node reference
-
beforeSetNodeType
sys:basebinding — rejectssetType(node, cd:definition).- Specified by:
beforeSetNodeTypein interfaceNodeServicePolicies.BeforeSetNodeTypePolicy- Parameters:
nodeRef- the node having its type set.oldType- the current type of the node.newType- the type the node will be given.
-