[Zope-CMF] Checking for a proxy role by a workflow transition guard expression

Richard Ettema richard.ettema@yoursolutions.com
Fri, 14 Mar 2003 16:01:22 -0000


>>
>> If I do a test in the expression field for the current user having the
role
>> of 'Reviewer' it fails.

>What's the expression you're using?

Thanks for the reply and sorry for the delay in answering your question.

The python scipt calls doActionFor like this...

  context.portal_workflow.doActionFor(obj, 'publish', comment='Item reviewed
and published.')

I have tried variations on the following expressions to test the python
script calling the doActioFor() for a proxy role. (I haven't kept a record
of the expressions tried).

python:
here.portal_membership.getAuthenticatedMember().has_permission('Review
portal content', here)

python: here.portal_membership.getAuthenticatedMember().has_role('Reviewer',
here)

python: user.has_role('Reviewer')

Came to the conclussion that it wasn't possible to test for the proxy role
of the python script as the proxy role is only valid within the scipt
itself. Is this correct?
I ended up testing the workflow 'request' for the python script id in the
path...

python: user.has_role('Reviewer') or
request['URL0']=='http://www.url.com/python_script'

Not the best of solutions. Thanks for any help in pointing me in the right
direction.

Richard

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.456 / Virus Database: 256 - Release Date: 18/02/2003