[Zope-CMF] One for the workflow gurus

Jean Jordaan jean@upfrontsystems.co.za
Tue, 12 Nov 2002 23:03:40 +0200


Sorry for the long mail, but I'm stumped .. any answers will be sorely
appreciated ..

My problem is this: I've defined a new workflow and some new
permissions. One of the transitions in that workflow is protected
by a new permission. When my user with that permission goes to a
document in the new workflow, this transition doesn't show up.

If I protect the transition with another permission, such as
View, it does show up.

This is how the permission is defined:

   during MyProject.__init__::

     RequestMarkupReview = 'BIS Request Markup Review '
     setDefaultRoles(RequestMarkupReview, ('Manager',)) # + DocBooker

   during CustomizationPolicy::

     portal.manage_permission(RequestMarkupReview, (r_docbooker,), 
acquire=1)

The transition is defined as follows::

     tdef = wf.transitions['submit_markup']
     tdef.setProperties(
         title='DocBooker requests OK',
         new_state_id='pending_markup_review',
         actbox_name='Submit markup',
         actbox_url='%(content_url)s/markup_submit_form',
         props={'guard_permissions':RequestMarkupReview})

I inserted some logging, and I see that
'trans.getGuard().check(getSecurityManager(), wf, obj)' returns 0
for my permission, but 1 for eg. View.
When I load 'portal_form/content_status_history' in both cases,
this is what I see. (I marked the interesting lines with '->'.)

When protected by 'BIS Request Markup Review'::

     Products/CMFPlone/WorkflowTool.py[68]:getTransitionsFor
     getTransitionsFor>
         tid: submit_markup,
         trans: <TransitionDefinition at submit_markup>,
   ->    trans.guard.__dict__: {'permissions': ('BIS Request Markup 
Review',)},
         trans.guard.expr: None,
         getSecurityManager(): <SecurityManager instance at 94090a8>,
   ->    trans.getGuard().check(getSecurityManager(), wf, obj): 0,
         wf: <DCWorkflowDefinition instance at 9637080>,
         obj: <BISDocument at BISDocument.2002-11-12.1729>

     Products/DCWorkflow/Guard.py[48]:check
     check>
         self: <Guard instance at 9639428>,
   ->    self.permissions: ('BIS Request Markup Review',),
         self.roles: (),
         self.expr: None,
         ob: <BISDocument at BISDocument.2002-11-12.1729>

     Products/CMFPlone/WorkflowTool.py[75]:getTransitionsFor
     getTransitionsFor>
   ->    avail_trans: []

When protected by View::

     Products/CMFPlone/WorkflowTool.py[68]:getTransitionsFor
     getTransitionsFor>
         tid: submit_markup,
         trans: <TransitionDefinition at submit_markup>,
   ->    trans.guard.__dict__: {'permissions': ('View',)},
         trans.guard.expr: None,
         getSecurityManager(): <SecurityManager instance at 9676c38>,
   ->    trans.getGuard().check(getSecurityManager(), wf, obj): 1,
         wf: <DCWorkflowDefinition instance at 9637080>,
         obj: <BISDocument at BISDocument.2002-11-12.1729>

     Products/DCWorkflow/Guard.py[48]:check
     check>
         self: <Guard instance at 96412b8>,
   ->    self.permissions: ('View',),
         self.roles: (),
         self.expr: None,
         ob: <BISDocument at BISDocument.2002-11-12.1729>

     Products/CMFPlone/WorkflowTool.py[75]:getTransitionsFor
     getTransitionsFor>
   ->    avail_trans: [{'title': 'DocBooker requests OK', 'id': 
'submit_markup', 'name': 'Submit markup'}]

Where can I look?

-- 
Jean Jordaan
http://www.upfrontsystems.co.za