This documentation relates to the 5.2 release of Comala Workflows

 Documentation for other versions of Comala Workflows is available too.

Overview

These examples summarise the macros you can use to change page restrictions.

Add a restriction

In this example, when the workflow moves in to the Review state, we use the {add-restriction} macro to restrict editing to the document creator and members of the reviewers group:

{workflow:name=Edit restrictions}
   {state:Editing|submit=Review}
   {state}
   {state:Review}
   {state}
   {trigger:statechanged|state=Review}
      {add-restriction:type=edit|user=@creator@|group=reviewers}
   {trigger}
{workflow}

Remove a restriction

In this example, we use the {remove-restriction} macro to remove the restrictions if the content review is approved.

{workflow:name=Edit restrictions}
   {state:Editing|submit=Review}
   {state}
   {state:Review|approved=Published|rejected=Editing}
      {approval:Review}
   {state}
   {state:Published}
   {state}
   {trigger:statechanged|state=Review}
      {add-restriction:type=edit|user=@creator@|group=reviewers}
   {trigger}
   {trigger:pageapproved|approval=Review}
      {remove-restriction:type=edit|user=@creator@|group=reviewers}
   {trigger}
{workflow}

Remove then Add restrictions → Set restrictions

If you remove restrictions of a certain type, then add restrictions of the same type, it can cause errors. This is due to the way Confluence works internally (database connections, long-running threads... reasons).

To avoid this issue, it's safer to use the {set-restrictions} macro when you need to remove, then add, restrictions of the same type.

In this example, when the review is approved, we clear all existing edit restrictions and only allow a maintenance group to edit the published content.

{workflow:name=Edit restrictions}
   {state:Editing|submit=Review}
   {state}
   {state:Review|approved=Published|rejected=Editing}
      {approval:Review}
   {state}
   {state:Published}
   {state}
   {trigger:statechanged|state=Review}
      {add-restriction:type=edit|user=@creator@|group=reviewers}
   {trigger}
   {trigger:pageapproved|approval=Review}
      {set-restrictions:type=edit|group=maintenance}
   {trigger}
{workflow}