comment_review_workflow added.
svn path=/plone.app.discussion/trunk/; revision=27361
This commit is contained in:
parent
468e32a6ed
commit
c55316d212
@ -3,6 +3,9 @@
|
||||
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
|
||||
i18n_domain="plone.app.discussion">
|
||||
|
||||
<include package="collective.autopermission" />
|
||||
<include package="plone.indexer" />
|
||||
|
||||
<include file="permissions.zcml" />
|
||||
<include package=".browser" />
|
||||
|
||||
|
@ -6,4 +6,9 @@
|
||||
|
||||
<!-- custom permissions are defined here -->
|
||||
|
||||
<permission
|
||||
id="plone.app.discussion.ReviewComments"
|
||||
title="Review comments"
|
||||
/>
|
||||
|
||||
</configure>
|
||||
|
9
plone/app/discussion/profiles/default/rolemap.xml
Normal file
9
plone/app/discussion/profiles/default/rolemap.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<rolemap>
|
||||
<permissions>
|
||||
<permission name="Review comments" acquire="True">
|
||||
<role name="Manager"/>
|
||||
<role name="Reviewer"/>
|
||||
</permission>
|
||||
</permissions>
|
||||
</rolemap>
|
9
plone/app/discussion/profiles/default/workflows.xml
Normal file
9
plone/app/discussion/profiles/default/workflows.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<object name="portal_workflow">
|
||||
<object name="comment_review_workflow" meta_type="Workflow"/>
|
||||
<bindings>
|
||||
<type type_id="Discussion Item">
|
||||
<bound-workflow workflow_id="one_state_workflow" />
|
||||
</type>
|
||||
</bindings>
|
||||
</object>
|
@ -0,0 +1,134 @@
|
||||
<?xml version="1.0"?>
|
||||
<dc-workflow xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
||||
i18n:domain="plone.app.discussion"
|
||||
workflow_id="comment_review_workflow"
|
||||
title="Comment Review Workflow"
|
||||
description="A simple workflow for comments"
|
||||
state_variable="review_state"
|
||||
initial_state="pending"
|
||||
i18n:attributes="title; description">
|
||||
|
||||
<permission>Access contents information</permission>
|
||||
<permission>Modify portal content</permission>
|
||||
<permission>View</permission>
|
||||
<permission>Reply to item</permission>
|
||||
|
||||
<state state_id="pending" title="Pending" i18n:attributes="title">
|
||||
<exit-transition transition_id="publish"/>
|
||||
<description i18n:translate="">
|
||||
Submitted, pending review.
|
||||
</description>
|
||||
<permission-map name="Access contents information" acquired="False">
|
||||
<permission-role>Manager</permission-role>
|
||||
<permission-role>Owner</permission-role>
|
||||
<permission-role>Reviewer</permission-role>
|
||||
</permission-map>
|
||||
<permission-map name="Modify portal content" acquired="False">
|
||||
<permission-role>Manager</permission-role>
|
||||
<permission-role>Owner</permission-role>
|
||||
<permission-role>Reviewer</permission-role>
|
||||
</permission-map>
|
||||
<permission-map name="View" acquired="False">
|
||||
<permission-role>Manager</permission-role>
|
||||
<permission-role>Owner</permission-role>
|
||||
<permission-role>Reviewer</permission-role>
|
||||
</permission-map>
|
||||
<permission-map name="Reply to item" acquired="False">
|
||||
</permission-map>
|
||||
</state>
|
||||
|
||||
<state state_id="published" title="Published" i18n:attributes="title">
|
||||
<description i18n:translate="">
|
||||
Visible to everyone, non-editable.
|
||||
</description>
|
||||
<permission-map name="Access contents information" acquired="False">
|
||||
<permission-role>Anonymous</permission-role>
|
||||
</permission-map>
|
||||
<permission-map name="Modify portal content" acquired="False">
|
||||
<permission-role>Manager</permission-role>
|
||||
</permission-map>
|
||||
<permission-map name="View" acquired="False">
|
||||
<permission-role>Anonymous</permission-role>
|
||||
</permission-map>
|
||||
<permission-map name="Reply to item" acquired="True">
|
||||
</permission-map>
|
||||
</state>
|
||||
|
||||
<transition transition_id="publish" new_state="published"
|
||||
title="Reviewer publishes content"
|
||||
trigger="USER"
|
||||
before_script="" after_script=""
|
||||
i18n:attributes="title">
|
||||
<description i18n:translate="">
|
||||
Publishing the comment makes it visible to other users.
|
||||
</description>
|
||||
<action url="%(content_url)s/content_status_modify?workflow_action=publish"
|
||||
category="workflow"
|
||||
i18n:translate="">Publish</action>
|
||||
<guard>
|
||||
<guard-permission>Review comments</guard-permission>
|
||||
</guard>
|
||||
</transition>
|
||||
|
||||
<variable variable_id="action" for_catalog="False"
|
||||
for_status="True" update_always="True">
|
||||
<description i18n:translate="">Previous transition</description>
|
||||
<default>
|
||||
|
||||
<expression>transition/getId|nothing</expression>
|
||||
</default>
|
||||
<guard>
|
||||
</guard>
|
||||
</variable>
|
||||
<variable variable_id="actor" for_catalog="False"
|
||||
for_status="True" update_always="True">
|
||||
<description i18n:translate="">
|
||||
The ID of the user who performed the previous transition
|
||||
</description>
|
||||
<default>
|
||||
|
||||
<expression>user/getUserName</expression>
|
||||
</default>
|
||||
<guard>
|
||||
</guard>
|
||||
</variable>
|
||||
<variable variable_id="comments" for_catalog="False"
|
||||
for_status="True" update_always="True">
|
||||
<description i18n:translate="">
|
||||
Comment about the last transition
|
||||
</description>
|
||||
<default>
|
||||
|
||||
<expression>python:state_change.kwargs.get('comment', '')</expression>
|
||||
</default>
|
||||
<guard>
|
||||
</guard>
|
||||
</variable>
|
||||
<variable variable_id="review_history" for_catalog="False"
|
||||
for_status="False" update_always="False">
|
||||
<description i18n:translate="">
|
||||
Provides access to workflow history
|
||||
</description>
|
||||
<default>
|
||||
|
||||
<expression>state_change/getHistory</expression>
|
||||
</default>
|
||||
<guard>
|
||||
<guard-permission>Request review</guard-permission>
|
||||
<guard-permission>Review portal content</guard-permission>
|
||||
</guard>
|
||||
</variable>
|
||||
<variable variable_id="time" for_catalog="False"
|
||||
for_status="True" update_always="True">
|
||||
<description i18n:translate="">
|
||||
When the previous transition was performed
|
||||
</description>
|
||||
<default>
|
||||
|
||||
<expression>state_change/getDateTime</expression>
|
||||
</default>
|
||||
<guard>
|
||||
</guard>
|
||||
</variable>
|
||||
|
||||
</dc-workflow>
|
22
plone/app/discussion/tests/test_workflow.py
Normal file
22
plone/app/discussion/tests/test_workflow.py
Normal file
@ -0,0 +1,22 @@
|
||||
import unittest
|
||||
|
||||
from Products.PloneTestCase.ptc import PloneTestCase
|
||||
from plone.app.discussion.tests.layer import DiscussionLayer
|
||||
|
||||
class WorkflowTest(PloneTestCase):
|
||||
|
||||
layer = DiscussionLayer
|
||||
|
||||
def test_permission(self):
|
||||
self.setRoles(('Reviewer',))
|
||||
self.failUnless(self.portal.portal_membership.checkPermission('Review comments', self.folder), self.folder)
|
||||
self.setRoles(('Member',))
|
||||
self.failIf(self.portal.portal_membership.checkPermission('Review comments', self.folder), self.folder)
|
||||
|
||||
def test_workflows_installed(self):
|
||||
self.failUnless('comment_review_workflow' in self.portal.portal_workflow.objectIds())
|
||||
self.assertEquals(('one_state_workflow',),
|
||||
self.portal.portal_workflow.getChainForPortalType('Discussion Item'))
|
||||
|
||||
def test_suite():
|
||||
return unittest.defaultTestLoader.loadTestsFromName(__name__)
|
Loading…
Reference in New Issue
Block a user