[PATCH 2 of 2 cubicweb] Add documentation on workflow permission

noe.gaumont at logilab.fr noe.gaumont at logilab.fr
Fri Oct 11 14:44:50 CEST 2019

# HG changeset patch
# User Noe Gaumont <ngaumont at logilab.fr>
# Date 1570790555 -7200
#      Fri Oct 11 12:42:35 2019 +0200
# Node ID d242a1692907746187b06dd2c0058d3c6ad8c6c6
# Parent  7e6aafa089d2d7653deaf6f005e8f43b386ebeb7
Add documentation on workflow permission

diff --git a/doc/book/devrepo/datamodel/define-workflows.rst b/doc/book/devrepo/datamodel/define-workflows.rst
--- a/doc/book/devrepo/datamodel/define-workflows.rst
+++ b/doc/book/devrepo/datamodel/define-workflows.rst
@@ -126,6 +126,13 @@ If we use an RQL condition on a transiti
 * `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 --git a/doc/book/devrepo/migration.rst b/doc/book/devrepo/migration.rst
--- a/doc/book/devrepo/migration.rst
+++ b/doc/book/devrepo/migration.rst
@@ -182,7 +182,13 @@ The following functions for workflow cre
 * `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` .

More information about the cubicweb-devel mailing list