Inherited restrictions for moved pages

Hi together,

 

I would need help with a custom script. The main goal is, that a moved page gets the same restrictions as the new parent page...

I already know that a custom script has to listen to the "PageMoveEvent", but also our developer would need some inspiration how he can develop that script...

 

Use case:

- Space A (anonymous access)

    - Page A (edit-restrictions for a special confluence-group - no inherited restrictions for sub-pages)

    - Page B (only confluence-users can view the pages --> inherited restrictions for sub-pages)

 

All newly created pages will be under Page B --> Non-confluence users will not see these pages. After the pages are approved, they will be moved the Page A and should get the same restrictions as Page A.

 

The Build-In Script form the Scriptrunner for inherited restrictions unfortunately only work for newly created pages, but not for moved pages. 

 

Thanks in advance and best regards

Alex 

 

 

1 answer

Here is a code for set restriction

page.addPermission(ContentPermission.createGroupPermission(ContentPermission.VIEW_PERMISSION, "Some Group"))
page.addPermission(ContentPermission.createUserPermission(ContentPermission.VIEW_PERMISSION, "Some user"))
pageManager.saveContentEntity(PublishPage.getEntity(), new DefaultSaveContext())

Write a script lister for MovePageEvent, try to find how to get page restriction and then run my code (on a loop)

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Wednesday in Jira

Join our webinar: How 1B+ feature flag events helped us build the new Jira

Every time you release software, there's a bit of risk – that there's a bug, that something breaks, or that the feature doesn't resonate with customers. Feature flagging helps make high stakes s...

91 views 0 1
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you