[Cubicweb] Change workflow's permissions with migration script

Adrien Di Mascio adrien.dimascio at logilab.fr
Mon Apr 18 07:45:59 CEST 2011


Hi Carlos,

On 17/04/2011 18:01, Carlos Balderas wrote:
> I would like to change permissions on a workflow , I tried changing the
> permissions in the postcreate file, where the workflow was created and
> then make a migration script with "sync_schema_props_perms()"
> instruction, but after upgrading my instance, this doesn't seem to work.

sync_schema_props_perms() will synchronize schema objects (entity and
relation types / definitions). The workflow is an application object and 
not part of the schema itself.

If you want to change transition permissions, you should probably use 
the ``set_permissions()`` method of Transition entities. For instance :

 >>> rset = rql('Any T WHERE T is Transition, T name "the-transition"')
 >>> transition = rset.get_entity(0, 0)
 >>> transition.set_permissions(required_groups, optional_conditions)

where ``required_groups`` and ``optional_conditions`` are the same 
parameters as the ones used in your postcreate.py script.


-- 
Adrien Di Mascio - LOGILAB, Paris (France).
Tél: 01.45.32.03.12
Formations - http://www.logilab.fr/formations
Développements - http://www.logilab.fr/services
Gestion de connaissances - http://www.cubicweb.org/


More information about the Cubicweb mailing list