Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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 

 

 

2 answers

Suggest an answer

Log in or Sign up to answer
1 vote
Neta Elyakim
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 01, 2018

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)

0 votes
Tony Gough _Adaptavist_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Nov 29, 2018 • edited

Hi Alexander,

I've recently put together a script which should accomplish what you need. You can find it in our code snippets repository using the following link:

https://bitbucket.org/snippets/Adaptavist/oedkLX

Hope this helps you out!

Kind regards,
Tony

Software Support Engineer @ Adaptavist

TAGS
AUG Leaders

Atlassian Community Events