Set Page Restrictions programmatically

Hi there,

I’m trying to find a way to do what the title says :slight_smile:

The confluence version I’m working with is 6.1.3 (server). The REST API has an endpoint to get the restrictions of a page, but there isn’t one to set them. I’ve searched through the javadocs for a while now and I haven’t found anything, but that doesn’t mean it’s not there, I may just have missed it.

Does anyone have a clue and is kind enough to share?

Thanks for reading
Claudio

Looks like there’s a tinymce end point but I would label that as a private api (i.e. it could change and then you’ll just be upset with me for suggesting it to me).

Since you’re running on Server I would suggest creating your own end point and using ContentPermissionManager (Atlassian Confluence 6.0.4 API) . You should be able to do something like:

contentPermissionManager.addContentPermission( ContentPermission.createUserPermission( ContentPermission.EDIT_PERMISSION , user), pageObject);

where pageObject is the Page object. user is a ConfluenceUser. See ContentPermission (Atlassian Confluence 6.0.4 API)

1 Like

Hi Daniel,

The ContentPermissionManager looks like it’s exactly what I was looking for - thank you!

I’ll let you know how it worked out. Cheers
Claudio