How to script permissions


I am trying to allow only certain parts of a xwiki to the anonymous user. More exactly, I would like to present only some parts of custom objects to unidentified users.

To setup a working configuration, I would like to be able to use mass permission setting on a number of pages/spaces. I could read on the documentation of Permissions in the User Guide:

If needed, it’s even possible to write some script to control programmatically exactly what users are allowed to do.

But i could not find how it was possible, neither in Adminisation nor in Developper guide


How is it possible to read and set permissions on a page via a script or a REST API ?

You might want to take a look at

It is possible but unfortunately I can’t find any documentation… Access rights are controlled by 2 objects:

  • XWiki.XWikiRights, can be added to any page, controls access rights only to that page
  • XWiki.XWikiGlobalRights, added to page preferences page (WebPreferences) or to wiki preferences page (XWiki.XWikiPreferences), affects everything below.

So you basically have to use the xobject (REST) API to add these objects to the right pages.

@mflorea , @tmortagne: Thank a lot to both of you. It is now much more clear.