Update Page Restrictions

In Confluence without ScriptRunner, editing restrictions added to a parent page are not inherited to child pages; however, view restrictions are inherited. Pages need to be restricted individually for editing.

Using the Update Page Restrictions built-in script, you can replace the editing restrictions to all of the child pages. It is quick and easy to select multiple page trees or individual pages to set page restrictions in bulk rather than doing it one-by-one. By selecting a parent page, you’ll apply all the restrictions to that page and all of its descendants. Running this script will replace any existing restrictions that the selected content has. 

Run the script

Follow these steps to run the built-in script:

  1. Navigate to General Configuration > ScriptRunner > Built-In Scripts.
  2. Select Update Page Restrictions.
  3. Select the Space you want to work with. 
  4. When Page(s) appears, you can select specific pages within the space to work with, or you can select the entire space.
  5. You have three options to choose for Restriction Level:
    1. Anyone can view and edit
    2. Anyone can view, only users and groups chosen in this script can edit
      When you select this option, two more fields appear: Groups and Users, where you determine which users and groups can edit. 
    3. Only users and groups chosen in this script can view and edit
      When you select this option, two more fields appear: Groups and Users, where you determine which users and groups can view and edit.
  6. Select Run
    Instead, you can select Preview to view changes before implementing them.
    A blank Update Page Restrictions script form

Once you select Run, the Results of the script appear. Restrictions are applied to the selected page and all ancestors of this page. However, this feature does not override the Confluence permission hierarchy. If you change the restrictions of a page, or set of pages, the restrictions of an ancestor of the page with a higher level of restrictions are observed.

Read more about page restrictions in the Confluence Page Restrictions documentation.

Examples

Restrict editing and viewing restrictions of certain pages  to a certain group

Using this built-in script, you can restrict certain pages within a space to certain groups of users. In the following example, we will restrict pages in a Customer Analytics section in the Analytics space to the customers group. Only they will be able to edit and view the pages.

To set up the script, follow these steps: 

  1. Navigate to General Configuration > ScriptRunner > Built-In Scripts.
  2. Select Update Page Restrictions.
  3. Enter Analytics for Space
  4. Select Customer Analytics for Pages
  5. Pick Only users and groups chosen in this script can view and edit for Restriction Level
  6. Enter customers for Groups.
  7. Select Run.
    The Update Page Restrictions form with the example content

Result

After running the script, you will see the result of the script:

Results of the script

On this page