Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Using remove-restriction will simply remove the specified permission type for the named user(s) on the content.

If you want to remove all added permissions of a specific type simply do not include users or groups in the {remove-restriction} macro. 

For example, when the following two macros are used together in a trigger, one will remove all added edit permission restrictions, the other will remove all added view permission restrictions.

Code Block
{remove-restriction:type=edit}
{remove-restriction:type=view}

You must include a separate macro for each type of permission.

The macro will not remove any page-level restrictions or other permissions that have been previously added for other users using add-restriction or set-restriction.

Remove then Add restrictions → Set restrictions

...

  • when the state changes to Review, only the content creator (Matilde Sipes in the example) and users who are members of the Confluence user group reviewers are able to edit the content
    Image Added

  • when the review is approved, using set-restrictions in a trigger on the pageapproved event we clear all existing edit restrictions and then only allow users who are members of the Confluence user group maintenance to edit the published content
    Image Added

Code Block
languagetext
themeRDark
{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}

The action of the {set-restrictions} macro initially removes all previously added restrictions on the content and then adds the permission for the maintenance group of users.

Be aware that

  • a user with administrator permission will still be able to edit the content
  • an admin user and anyone who has been given edit permission using the macros will be able to change the page-level restrictions
  • a user who is not listed in the restrictions macro as having edit permission will be able to view the page-level content permissions. They will however not see the workflow state breadcrumbs on the page

One problem with our example is that any transition back to the editing state will retain the permission restrictions.

We can simply add the following trigger to remove the added content page permissions

Code Block
{trigger:statechanged|state=Editing}
    {remove-restriction:type=view} 
	{remove-restriction:type=edit}
{trigger}


Info

When using the add-restriction or set-restrictions the specified Confluence permission will be added to the users listed.

If there are other users who have Confluence permissions for the content but are not listed in the macro, these users will have their permissions restricted.

...