This site has moved to the integrated Appfire documentation and information site for our apps.

From February 2024 this site is no longer updated.

Take a look here! If you have any questions please email support@appfire.com

Restricting drafts to specific users using the add-restriction macro

Overview

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

These macros are used as part of a workflow trigger to set the content permission for the specified users and change the capability of these listed users.

The Confluence user(s) or a user who is a member of a Confluence group listed in the macro will have the type of permission (view, or editspecified in the macro.

Other users who are not listed in the macro will have their permission for the content restricted.

Restricting drafts to specific users

If you need to add view page restrictions when a page is created (and a label is added for a label-based space workflow) and manage changes in the users who can view or edit the content as you cycle through the workflow you can use the {add-restriction} and {remove-restriction} macros.

You can use the macros in a number of workflow triggers to manage user permission when the content is in the draft state, In Progress

  • when the page is created - add view restriction
  • when the page Published - remove view restrictions
  • when the content state goes back to the draft In Progress state- add edit restriction and add view restriction


{workflow:name=Simple approval workflow View restrictions}
    {description}
        Group reviewers can Edit the page.
        Once the page is Published, everybody can View the page.
        Once the page transitions to In Progress, only members of the Confluence user group reviewers can View the Published page, reviewers can view and edit the draft In Progress content
    {description}
    {state:In Progress|submit=Published}
    {state}
    {state:Published|final=true|updated=In Progress|hideselection=true}
    {state}
    {trigger:pagecreated}
        {add-restriction:type=View|group=reviewers}
    {trigger}
    {trigger:statechanged|state=In Progress}
        {add-restriction:type=View|group=reviewers}
        {add-restriction:type=Edit|group=reviewers}
    {trigger}
    {trigger:statechanged|state=Published}
        {remove-restriction:type=View}
    {trigger}
{workflow}



When the content is created, and the workflow is added as an active space workflow the content has page restrictions added.

The view and edit permission for the content has been limited to the Confluence group reviewers.


Any Confluence users (Everyone) with permission for the content cannot now view or edit the content.  

  • remember that a user who has administrator permission can also still view and edit the content.

When the content transitions to the Published state the view restriction is removed using the {remove-restriction} macro for users who are not members of the reviewers group.

There is no change in the limit for users who have the edit permission.

If the content returns to the draft In Progress state the limit on the view permission is added again.


If it is a content label filter workflow, an additional trigger is required to add the view restriction if the workflow filter label is added to the content.

{trigger:labeladded|label=restricttoreviewers}
        {add-restriction:type=View|group=reviewers}
{trigger}


You also want to add a labelremoved trigger to remove the limit on the page-level restrictions if the label is removed from the content.

{trigger:labelremoved|label=restricttoreviewers}
        {remove-restriction:type=View}
		{remove-restriction:type=Edit}
{trigger}


When using the {add-restriction} or {remove-restriction} macro the specified Confluence permission will be added/removed 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.

You can also use the {set-restrictions} macro to add a view or edit permission restriction - the macro will remove any existing limit on the type of permission (edit or view) before setting the restriction.


Related pages