set-restrictions macro

set-restrictions macro

Overview

TheĀ set-restrictionsĀ macro is similar to theĀ add-restrictionĀ macro in setting Confluence View or Edit permissions to named users. However, before doing so, it removes any existing permissions of that type.

Restrictions don't give users permissions to content, but rather limit who has those permissions.

For example, if everyone has edit/view permissions for the space, adding edit restrictions to a page for two users - user A and user B -Ā means that only these two users - user A and user B - can edit the page. Everyone else can view the page.

Where to use it?

Optional.

One or moreĀ set-restrictionsĀ macros can be put in aĀ triggerĀ macro.

Parameters

Parameter

Required

Default

Notes

Ver

Parameter

Required

Default

Notes

Ver

type



What type of permission to set?

  • view – assign the user/group view permission

  • edit – assign the user/group edit permission

4.5

The permissions are set using Confluence's content-level permission system and can thus be altered via the padlock icon.

user



One or more users to assign type permission to:

4.5

group



One or more user groups to assign type permission to:

4.5

At least one user or group must be specified. Both can also be used at the same time.

Ā Invalid users/groups are ignored and the macro sets the restrictions for the valid users defined (from v6.16.14+).

Example

This is for a new page ...

{workflow:Restrictions} {state:Test} {state} {trigger:pagecreated} {set-restrictions:type=view|user=bob} {trigger} {workflow}

Ā 

... and is equivalent to:

{workflow:Restrictions} {state:Test} {state} {trigger:pagecreated} {remove-restriction:type=view} {add-restriction:type=view|user=bob} {trigger} {workflow}

This is for a new blog post ...

{workflow:Restrictions} {state:Test} {state} {trigger:newscreated} {set-restrictions:type=view|user=bob} {trigger} {workflow}

Ā 

... and is equivalent to:

{workflow:Restrictions} {state:Test} {state} {trigger:newscreated} {remove-restriction:type=view} {add-restriction:type=view|user=bob} {trigger} {workflow}

UsingĀ the set-restrictionsĀ macro (markup on the left) may help avoid permissions errors in the interim period between clearing permissions and adding new permissions (markup on the right).

If using a workflow for blog posts and pages, add both triggers to add the view restriction on creating a blog post or a page.

{workflow:Restrictions} {state:Draft|approved=Approved} {approval:Review|assignable=true} {state} {state:Approved|final=true|updated=Draft} {state} {trigger:newscreated} {set-restrictions:type=view|user=bob} {trigger} {trigger:pagecreated} {set-restrictions:type=view|user=bob} {trigger} {trigger:newsapproved} {remove-restriction|type=view} {trigger} {trigger:pageapproved} {remove-restriction|type=view} {trigger} {trigger:statechanged|state=Draft} {set-restrictions:type=view|user=bob} {trigger} {workflow}

Ā 

These examples use the newscreated and pagecreated events to limit the page-level permissions. They only work when the workflow is a space workflow and the workflow is enabled in the space at the time the page or blog post is created.

All examples

See also

Workflow Authoring Guide

Need support? Create a request with our support team.

Copyright Ā© 2005 - 2025 Appfire | All rights reserved.