---
title: "add-restriction macro"
canonical: "https://support.appfire.com/space/CDML/649793069/add-restriction%20macro"
format: markdown
---
> Macro (aura-html)


## Overview

> Macro (excerpt)
> 
> Add content view/edit permissions

The `add-restriction` macro is used to add **view** or **edit** content-level permissions.

When using the `add-restriction` macro the specified Confluence permissions are restricted to the users listed.

> ℹ️ Restrictions don't give users permission for a page or blog post - they limit the permissions to the named users.

For example, if everyone has edit/view permissions for the space and you add edit restrictions to a page - for user A and user B - only user A and user B can edit the page. Everyone else is only able to view the page.

## Where to use it?

Optional.

One or more `add-restriction` macros can be put in a [trigger macro](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649859133).

If you want to remove these restrictions you can use the [remove-restriction](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649957267) macro.

<span style="color: #172b4d">You can remove/add or add/remove restrictions using these macros in any order.</span>

<span style="color: #172b4d">I</span>f you want to add restrictions immediately after removing restrictions of the same type, you can use the [set-restrictions macro](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649662496) instead.†

## Parameters

| **Parameter** | **Required** | **Default** | **Notes** |
| --- | --- | --- | --- |
| `type` | :check_mark: |  | What type of permission to set?<br>- `view` – assign the user/group view permission
- `edit` – assign the user/group edit permission |
| Note: The permissions are set using Confluence's content-level permissions system and can thus be altered via the padlock icon. |
| `user` | :info: |  | One or more users to assign `type` permission to:<br>- Comma-separated list of usernames
- Supports [Value References](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649694302) |
| `group` | :info: |  | One or more user groups to assign `type` permission to:<br>- Comma-separated list of user groups
- Supports [Value References](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649694302) |
| > ℹ️ At least one user or group must be specified. Both can also be used at the same time. |
| † In some cases, due to Confluence permission threads, rather than using [remove-restriction](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649957267) macro then `add-restriction`, it may be useful to use [set-restrictions](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649662496) macro. This macro clears any existing restriction of the type being set (**view** or **edit**) before setting that permission for the listed users or groups. |
| > 📝 From v6.16.14+, when adding the `add-restrictions` macro to a trigger, any an invalid user/group (disabled/deleted user) will be ignored and restrictions will be set for the defined valid users. |

## Example

The following examples restrict view permission to

- the user who created the page
- users who are members of the Confluence user group **moderators**

Adding a view restriction on creating a new page:

```plaintext
{workflow:Restrictions}
   {state:Test}
   {state}
   {trigger:pagecreated}
      {add-restriction:type=view|user=@user@|group=moderators}
   {trigger}
{workflow}
```

Adding a view restriction on creating a new blog post:

```plaintext
{workflow:Restrictions}
   {state:Test}
   {state}
   {trigger:newscreated}
      {add-restriction:type=view|user=@user@|group=moderators}
   {trigger}
{workflow}
```

Adding a view restriction on creating a new blog post or a new page requires both the above triggers in the applied workflow:

```plaintext
{workflow:Restrictions}
   {state:Test}
   {state}
   {trigger:newscreated}
      {add-restriction:type=view|user=@user@|group=moderators}
   {trigger}
   {trigger:pagecreated}
      {add-restriction:type=view|user=@user@|group=moderators}
   {trigger}
{workflow}
```

The restrictions can then be removed, for example, on approving the content

```plaintext
{workflow:Restrictions}
   {state:Draft|approved=Published}
   {approval=Publish|group=moderators|minimimum=2}
   {state}
   {state:Published|final=true|updated=Draft}
   {state}
   {trigger:newscreated}
      {add-restriction:type=view|user=@user@|group=moderators}
   {trigger}
   {trigger:pagecreated}
      {add-restriction:type=view|user=@user@|group=moderators}
   {trigger}
   {trigger:pageapproved}
      {remove-restriction:type=view}
   {trigger}
   {trigger:newsapproved}
     {remove-restriction:type=view}
   {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

> Macro (contentbylabel)

### See also

External Links:

- [Page Restrictions](https://confluence.atlassian.com/doc/page-restrictions-139414.html)

[Workflow Authoring Guide](https://appfire.atlassian.net/wiki/spaces/CDML/pages/648611901):

- [Conditions](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649694110)
- [Roles and Permissions](https://appfire.atlassian.net/wiki/spaces/CDML/pages/650217543)
- [Value References](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649694302)
- [remove-restriction macro](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649957267)
- [set-restrictions macro](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649662496)