Hello,
In the opposite of some other questions, it there any "automated" or "general configuration" way to allow an administrator to change the restriction on a confluence page?
Let me explain...
Due to some infrastructure change we might need to update several pages on a confluence with the help of a script. There are different solutions based on the Confluence CLI or with python.
However the page edit fails if the page is restricted.
An administrator can view a restricted page (as long as he knows the url) and even change the restriction on this page in order to allow himself to edit its content. He can also remove this permission then after.
Conclusion: An administrator can change the page permission on a restricted page via the GUI. Is there any equivalent solution with script? Alternativaly is there any general configuration that would allow an administrator to edit every page?
Thanks in advance,
Best regards,
Olivier
Eventually I found the python solution thanks to the https://developer.atlassian.com/display/CONFDEV/Remote+Confluence+Methods.
pageperms = client.confluence2.getContentPermissionSet(token, page['id'], 'Edit'); tmppageperms = copy.deepcopy(pageperms) for contentPermission in tmppageperms['contentPermissions']: if contentPermission['userName'] == user: break; if ('contentPermission' not in locals() or contentPermission['userName'] != user): tmppageperms['contentPermissions'].append({'userName': user, 'type': 'Edit'}) client.confluence2.setContentPermissions(token, page['id'], 'Edit', tmppageperms['contentPermissions']); raw_input('Press Enter to continue...') client.confluence2.setContentPermissions(token, page['id'], 'Edit', pageperms['contentPermissions']);
To be combined with the update page routine as described in this other article https://answers.atlassian.com/questions/104580/how-to-update-a-page-from-python.
Using Confluence Command Line Interface and the addPermissions action:
confluence --action addPermissions --space Experiment --title myPage --permissions view,edit --userId automation
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah yes I did not see this action. Thanks for the info.
The thing is I started with a python script and I discovered later that Confluence CLI can also update the page content (eg getSource+storePage).
I'm sure there's a solution with python but I could not find it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Regards
Steve
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks you Steve for this other solution.
I think it's a bit tricky to delete a space so I would rather avoid this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.