# HG changeset patch # User Noe Gaumont # Date 1570790555 -7200 # Node ID d242a1692907746187b06dd2c0058d3c6ad8c6c6 # Parent 7e6aafa089d2d7653deaf6f005e8f43b386ebeb7 Add documentation on workflow permission diff -r 7e6aafa089d2 -r d242a1692907 doc/book/devrepo/datamodel/define-workflows.rst --- a/doc/book/devrepo/datamodel/define-workflows.rst Fri Oct 11 12:41:16 2019 +0200 +++ b/doc/book/devrepo/datamodel/define-workflows.rst Fri Oct 11 12:42:35 2019 +0200 @@ -126,6 +126,13 @@ * `X`, the entity on which we may pass the transition * `U`, the user executing that may pass the transition +It's also possible to get a given transition (usefull in migration) from a +workflow use `transition_by_name(trname)`. +To update the permission associated to the transition use +`set_permissions(requiredgroups=(), conditions=(), reset=True)`. +If `reset` is False, then the new permission are added instead of replacing the +old one. + .. image:: ../../../images/03-transitions-view_en.png diff -r 7e6aafa089d2 -r d242a1692907 doc/book/devrepo/migration.rst --- a/doc/book/devrepo/migration.rst Fri Oct 11 12:41:16 2019 +0200 +++ b/doc/book/devrepo/migration.rst Fri Oct 11 12:42:35 2019 +0200 @@ -182,7 +182,13 @@ scripts: * `add_workflow(label, workflowof, initial=False, commit=False, **kwargs)`, adds a new workflow - for a given type(s) + for a given type(s), +* `get_workflow_for(etype)`, return the workflow for the given entity type, +* `transition_by_name(self, trname)`, method of cubicweb.entities.wfobjs.Workflow instance + that returns the transition named `trname`, +* `set_permissions(self, requiredgroups=(), conditions=(), reset=True)` method of + cubicweb.entities.wfobjs.Transition instance that sets or adds (if `reset` is False) + groups and conditions for this transition. You can find more details about workflows in the chapter :ref:`Workflow` .