Class CommentPermissionPolicy

java.lang.Object
fr.becpg.repo.policy.AbstractBeCPGPolicy
fr.becpg.repo.comment.policy.CommentPermissionPolicy
All Implemented Interfaces:
org.alfresco.repo.copy.CopyServicePolicies.OnCopyCompletePolicy, org.alfresco.repo.copy.CopyServicePolicies.OnCopyNodePolicy, org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy, org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy, org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy, org.alfresco.repo.policy.ClassPolicy, org.alfresco.repo.policy.Policy

public class CommentPermissionPolicy extends AbstractBeCPGPolicy implements org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy, org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy, org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
Refuses the edition and the deletion of a comment when the CommentPermissionService does not allow it, whatever the way the comment is reached (Share, REST API, script). The system user, the creation of the comment itself, the cascade deletion of the commented node and the moves out of the archive store (restoration or purge from the trashcan) are let through.
Author:
valentin
  • Field Details

    • KEY_COMMENTS_CREATED_IN_TXN

      private static final String KEY_COMMENTS_CREATED_IN_TXN
    • commentPermissionService

      private CommentPermissionService commentPermissionService
    • commentService

      private org.alfresco.repo.forum.CommentService commentService
  • Constructor Details

    • CommentPermissionPolicy

      public CommentPermissionPolicy()
  • Method Details

    • setCommentPermissionService

      public void setCommentPermissionService(CommentPermissionService commentPermissionService)

      Setter for the field commentPermissionService.

      Parameters:
      commentPermissionService - a CommentPermissionService object
    • setCommentService

      public void setCommentService(org.alfresco.repo.forum.CommentService commentService)

      Setter for the field commentService.

      Parameters:
      commentService - a CommentService object
    • doInit

      public void doInit()

      doInit.

      Specified by:
      doInit in class AbstractBeCPGPolicy
    • onCreateNode

      public void onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
      Specified by:
      onCreateNode in interface org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy
    • onUpdateProperties

      public void onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef commentNodeRef, Map<org.alfresco.service.namespace.QName,Serializable> before, Map<org.alfresco.service.namespace.QName,Serializable> after)
      Specified by:
      onUpdateProperties in interface org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy
    • beforeDeleteNode

      public void beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef commentNodeRef)
      Specified by:
      beforeDeleteNode in interface org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
    • checkCanModify

      private void checkCanModify(org.alfresco.service.cmr.repository.NodeRef commentNodeRef, String refusalMessage)
    • isArchived

      private boolean isArchived(org.alfresco.service.cmr.repository.NodeRef commentNodeRef)
    • isCreatedInCurrentTransaction

      private boolean isCreatedInCurrentTransaction(org.alfresco.service.cmr.repository.NodeRef commentNodeRef)
    • isDiscussableNodeBeingDeleted

      private boolean isDiscussableNodeBeingDeleted(org.alfresco.service.cmr.repository.NodeRef commentNodeRef)