Add documentation on workflow permission
authorNoe Gaumont <ngaumont@logilab.fr>
Fri, 11 Oct 2019 12:42:35 +0200
changeset 12733 d242a1692907
parent 12732 7e6aafa089d2
child 12734 d177d8ab4fd3
Add documentation on workflow permission
doc/book/devrepo/datamodel/define-workflows.rst
doc/book/devrepo/migration.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
 
--- 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` .