Defining Content Constraints for Workflows

Scrivito’s workflows not only let you specify the teams for editing and publishing a working copy’s content. Furthermore, you can define constraints to restrict the website area or the kind of content the teams should work on.

If a workflow doesn’t have constraints, the teams simply aren’t restricted and can add or delete or change whichever piece of content they deem appropriate.

If provided, the content constraints represent permits. Any number of permits can be specified, and every additional permit broadens the scope of actions the teams can take.

Constraints are expressed as a JSON array whose elements, the permits, are again arrays made up of conditions.

A permit consists of one or more attribute-related conditions a CMS object must meet to be covered by the workflow, i.e. to be changeable. If more than one condition is specified in a permit, all of them must be met for the permit to be effective. Optionally, a condition can be negated.

Here some examples:

Permit A CMS object is covered by the workflow if …
[[{ "field": "lang", "operator": "equals", "value": "en" }]] … its lang attribute equals en.
[[{ "field": "lang", "operator": "equals", "value": ["en", "de"] }]]
… its lang attribute equals en or de.
[[{ "field": "lang", "operator": "equals", "value": ["fr", "it"], "negate": "true" }]]
… its lang attribute equals neither fr nor it.
[[{ "field": "multilang", "operator": "equals", "value": "yes" }, { "field": "lang", "operator": "equals", "value": "en" }]] … its multilang attribute equals yes and its lang attribute equals en.

As the field of a condition the built-in attributes _obj_class and _path and all custom attributes of the string, stringlist, enum and multienum types can be specified.

Next to the equals operator, starts_with and is_inside_subtree_of are available, but only in connection with the _path attribute. starts_with checks whether a CMS object is the parent of or a child in a subtree. is_inside_subtree_of does the same but expects the value to be an object ID, not a path prefix.

Permit A CMS object is covered by the workflow if …
[[{ "field": "_path", "operator": "starts_with", "value": "/product" }]] … its _path attribute value starts with /product.
[[{ "field": "_path", "operator": "is_inside_subtree_of", "value": "2b2883c23aca09da" }]]
… its _path attribute value starts with the _path attribute value of the Object whose ID is 2b2883c23aca09da.

If, in the second and last example above, the object with the specified ID doesn’t have a path, is_inside_subtree_of is true for this object only, which is ideal for permitting changes on a per-page basis, for example.