Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
maxLevel2
minLevel2
absoluteUrltrue
excludeOverview
typeflat
separatorpipe

Overview

Excerpt
hiddentrue

Reset content view/edit restrictions

The 

{

set-restrictions

}

 macro is similar to the 

{

add-restriction

}

 macro in

that it sets either

setting Confluence View or Edit permissions to named users. However, before doing so, it removes any existing permissions of that type

.

Where to use it?

Optional.

One or more {set-restrictions} macros can be put in a {trigger} macro

.

Info

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

have

has those permissions.

For example, if everyone has edit/view permissions for the space

and you add

, adding edit restrictions to a page for two users - user A and user B

, only

- means that only these two users - user A and user B - can edit the page

, and everyone else just

. 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

type

(tick)


What type of permission to set?

  • view – assign the user/group view permission

  • edit – assign the user/group edit permission

4.5

Note:

The permissions are set using Confluence's content-level

permissions

permission system and can thus be altered via the padlock icon.

user

(info)


One or more users to assign type permission to:

Comma
  • comma-separated list of usernames

Supports

4.5

group

(info)


One or more user groups to assign type permission to:

Comma
  • comma-separated list of user groups

Supports

4.5

Info
(info)

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

(blue star)

 Invalid users/groups

will be

are ignored and the macro

will set

sets the restrictions for the valid users defined (from v6.16.14+).

Example

This is for a new page ...

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

... and is equivalent to:

Code Block
languagetextthemeRDark
{workflow:Restrictions}
   {state:Test}
   {state}
   {trigger:pagecreated}
      {remove-restriction:type=view}
      {add-restriction:type=view|user=bob}
   {trigger}
{workflow}
Using {set-restrictions} 

This is for a new blog post ...

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

... and is equivalent to:

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

Code Block
{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

Filter by label (Content by label)
showLabelsfalse
max100
showSpacefalse
sorttitle
excerptTypesimple
cqllabel = "macro-set-restrictions" and label = "example" and space = currentSpace ( )

See also

External Links:

: