source: publico/ILPortalCasas/trunk/Ouvidoria/PloneOnbudsman/Extensions/onbudsman_folder_workflow.py @ 501

Última Alteração nesse arquivo desde 501 foi 501, incluída por rafahelabazzanella, 15 anos atrás

Alterado workflow do OnbudsmanFolder?

File size: 10.9 KB
Linha 
1"""Workflow: onbudsman_folder_workflow
2"""
3
4# Copyright (c) 2005 by Interlegis
5#
6
7# Generator: ArchGenXML Version 1.4.0-beta2 devel
8#            http://plone.org/products/archgenxml
9#
10# GNU General Public Licence (GPL)
11#
12# This program is free software; you can redistribute it and/or modify it under
13# the terms of the GNU General Public License as published by the Free Software
14# Foundation; either version 2 of the License, or (at your option) any later
15# version.
16# This program is distributed in the hope that it will be useful, but WITHOUT
17# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
19# details.
20# You should have received a copy of the GNU General Public License along with
21# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22# Place, Suite 330, Boston, MA  02111-1307  USA
23#
24__author__    = '''STC Interlegis <admin-stc@interlegis.gov.br>'''
25__docformat__ = 'plaintext'
26__version__   = '$ Revision 0.0 $'[11:-2]
27
28from Products.CMFCore.utils import getToolByName
29from Products.CMFCore.WorkflowTool import addWorkflowFactory
30from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
31from Products.ExternalMethod.ExternalMethod import ExternalMethod
32
33##code-section create-workflow-module-header #fill in your manual code here
34##/code-section create-workflow-module-header
35
36
37productname = 'PloneOnbudsman'
38
39def setuponbudsman_folder_workflow(self, workflow):
40    """Define the onbudsman_folder_workflow workflow.
41    """
42    # add additional roles to portal
43    portal = getToolByName(self,'portal_url').getPortalObject()
44    data = list(portal.__ac_roles__)
45    for role in ['Member\nAnonymous']:
46        if not role in self.__ac_roles__:
47            data.append(role)
48    portal.__ac_roles__ = tuple(data)
49
50    workflow.setProperties(title='onbudsman_folder_workflow')
51
52    ##code-section create-workflow-setup-method-header #fill in your manual code here
53    ##/code-section create-workflow-setup-method-header
54
55
56    for s in ['published', 'authenticated', 'published_post', 'published_view', 'autheticated_post', 'authenticated_view']:
57        workflow.states.addState(s)
58
59    for t in []:
60        workflow.transitions.addTransition(t)
61
62    for v in ['review_history', 'comments', 'time', 'actor', 'action']:
63        workflow.variables.addVariable(v)
64
65    for p in ['View', 'Modify portal content', 'Change portal events', 'Add OnbudsmanClaim Content', 'Add portal contents', 'Access contents information']:
66        workflow.addManagedPermission(p)
67
68    for l in []:
69        if not l in workflow.worklists.objectValues():
70            workflow.worklists.addWorklist(l)
71
72    ## Initial State
73
74    workflow.states.setInitialState('published')
75
76    ## States initialization
77
78    stateDef = workflow.states['published']
79    stateDef.setProperties(title="""Published""",
80                           transitions=[])
81    stateDef.setPermission('View',
82                           1,
83                           ['Anonymous', 'Manager', 'Reviewer', 'Member'])
84    stateDef.setPermission('Modify portal content',
85                           1,
86                           ['Anonymous', 'Owner', 'Manager'])
87    stateDef.setPermission('Change portal events',
88                           1,
89                           ['Manager'])
90    stateDef.setPermission('Add OnbudsmanClaim Content',
91                           0,
92                           ['Anonymous', 'Manager'])
93    stateDef.setPermission('Add portal contents',
94                           0,
95                           ['Anonymous', 'Manager', 'Reviewer', 'Member\nAnonymous', 'Manager', 'Reviewer', 'Member'])
96    stateDef.setPermission('Access contents information',
97                           1,
98                           ['Anonymous', 'Manager', 'Reviewer', 'Member'])
99
100    stateDef = workflow.states['authenticated']
101    stateDef.setProperties(title="""Authenticated""",
102                           transitions=[])
103    stateDef.setPermission('View',
104                           1,
105                           ['Anonymous', 'Manager', 'Reviewer', 'Member'])
106    stateDef.setPermission('Modify portal content',
107                           1,
108                           ['Owner', 'Manager'])
109    stateDef.setPermission('Change portal events',
110                           1,
111                           ['Owner', 'Manager'])
112    stateDef.setPermission('Add OnbudsmanClaim Content',
113                           0,
114                           ['Member', 'Manager'])
115    stateDef.setPermission('Access contents information',
116                           1,
117                           ['Anonymous', 'Manager', 'Reviewer', 'Member'])
118
119    stateDef = workflow.states['published_post']
120    stateDef.setProperties(title="""Published Post""",
121                           transitions=[])
122    stateDef.setPermission('View',
123                           1,
124                           ['Anonymous', 'Manager', 'Reviewer', 'Member'])
125    stateDef.setPermission('Modify portal content',
126                           1,
127                           ['Owner', 'Manager'])
128    stateDef.setPermission('Change portal events',
129                           1,
130                           ['Owner', 'Manager'])
131    stateDef.setPermission('Add OnbudsmanClaim Content',
132                           0,
133                           ['Anonymous', 'Manager'])
134    stateDef.setPermission('Add portal contents',
135                           0,
136                           ['Anonymous', 'Manager', 'Reviewer', 'Member'])
137    stateDef.setPermission('Access contents information',
138                           1,
139                           ['Anonymous', 'Manager', 'Reviewer', 'Member'])
140
141    stateDef = workflow.states['published_view']
142    stateDef.setProperties(title="""Published View""",
143                           transitions=[])
144    stateDef.setPermission('View',
145                           1,
146                           ['Anonymous', 'Manager', 'Reviewer', 'Member'])
147    stateDef.setPermission('Modify portal content',
148                           1,
149                           ['Owner', 'Manager'])
150    stateDef.setPermission('Change portal events',
151                           1,
152                           ['Owner', 'Manager'])
153    stateDef.setPermission('Access contents information',
154                           1,
155                           ['Anonymous', 'Manager', 'Reviewer', 'Member'])
156
157    stateDef = workflow.states['autheticated_post']
158    stateDef.setProperties(title="""Authenticated Post""",
159                           transitions=[])
160    stateDef.setPermission('View',
161                           1,
162                           ['Anonymous', 'Manager', 'Reviewer', 'Member'])
163    stateDef.setPermission('Modify portal content',
164                           1,
165                           ['Owner', 'Manager'])
166    stateDef.setPermission('Change portal events',
167                           1,
168                           ['Owner', 'Manager'])
169    stateDef.setPermission('Add OnbudsmanClaim Content',
170                           0,
171                           ['Anonymous', 'Manager'])
172    stateDef.setPermission('Access contents information',
173                           1,
174                           ['Anonymous', 'Manager', 'Reviewer', 'Member'])
175
176    stateDef = workflow.states['authenticated_view']
177    stateDef.setProperties(title="""Authenticated View""",
178                           transitions=[])
179    stateDef.setPermission('View',
180                           1,
181                           ['Anonymous', 'Manager', 'Reviewer', 'Member'])
182    stateDef.setPermission('Modify portal content',
183                           1,
184                           ['Owner', 'Manager'])
185    stateDef.setPermission('Change portal events',
186                           1,
187                           ['Owner', 'Manager'])
188    stateDef.setPermission('Access contents information',
189                           1,
190                           ['Anonymous', 'Manager', 'Reviewer', 'Member'])
191
192    ## Transitions initialization
193
194    ## State Variable
195    workflow.variables.setStateVar('review_state')
196
197    ## Variables initialization
198    variableDef = workflow.variables['review_history']
199    variableDef.setProperties(description="""Provides access to workflow history""",
200                              default_value="""""",
201                              default_expr="""state_change/getHistory""",
202                              for_catalog=0,
203                              for_status=0,
204                              update_always=0,
205                              props={'guard_permissions': 'Request review; Review portal content'})
206
207    variableDef = workflow.variables['comments']
208    variableDef.setProperties(description="""Comments about the last transition""",
209                              default_value="""""",
210                              default_expr="""python:state_change.kwargs.get('comment', '')""",
211                              for_catalog=0,
212                              for_status=1,
213                              update_always=1,
214                              props=None)
215
216    variableDef = workflow.variables['time']
217    variableDef.setProperties(description="""Time of the last transition""",
218                              default_value="""""",
219                              default_expr="""state_change/getDateTime""",
220                              for_catalog=0,
221                              for_status=1,
222                              update_always=1,
223                              props=None)
224
225    variableDef = workflow.variables['actor']
226    variableDef.setProperties(description="""The ID of the user who performed the last transition""",
227                              default_value="""""",
228                              default_expr="""user/getId""",
229                              for_catalog=0,
230                              for_status=1,
231                              update_always=1,
232                              props=None)
233
234    variableDef = workflow.variables['action']
235    variableDef.setProperties(description="""The last transition""",
236                              default_value="""""",
237                              default_expr="""transition/getId|nothing""",
238                              for_catalog=0,
239                              for_status=1,
240                              update_always=1,
241                              props=None)
242
243    ## Worklists Initialization
244
245
246    # WARNING: below protected section is deprecated.
247    # Add a tagged value 'worklist' with the worklist name to your state(s) instead.
248
249    ##code-section create-workflow-setup-method-footer #fill in your manual code here
250    ##/code-section create-workflow-setup-method-footer
251
252
253
254def createonbudsman_folder_workflow(self, id):
255    """Create the workflow for PloneOnbudsman.
256    """
257   
258    ob = DCWorkflowDefinition(id)
259    setuponbudsman_folder_workflow(self, ob)
260    return ob
261
262addWorkflowFactory(createonbudsman_folder_workflow,
263                   id='onbudsman_folder_workflow',
264                   title='onbudsman_folder_workflow')
265
266##code-section create-workflow-module-footer #fill in your manual code here
267##/code-section create-workflow-module-footer
268
Note: Veja TracBrowser para ajuda no uso do navegador do trac.
 

The contents and data of this website are published under license:
Creative Commons 4.0 Brasil - Atribuir Fonte - Compartilhar Igual.