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:

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.

 

All examples

See also

Workflow Authoring Guide