How to check user space permissions?

In my particular scenario, I’d want my add-on to check if current user has “add/delete restrictions” permissions for particular custom content id. Is there any REST API method or other way to get this information?

1 Like

Hey @LukaszWiatrak I was talking with the Confluence Cloud Ecosystem team today to see what they recommend. Here is how they suggest doing it.

  1. Call the following GET /wiki/rest/api/content/{id}/restriction/byOperation/{operationKey} to get the restrictions of the page, this will return both the users and the groups. The operationKey allows read and update if the user/group has access to both they can add/delete. Docs
  2. If the user is not in the list above you’ll need to check to see if the user is in one of the restricted groups. Call the following https://developer.atlassian.com/cloud/confluence/rest/#api-user-memberof-get to get back the groups the user is apart of and then do a test to see if any of those groups are apart of the list of groups that came back in the first call.
4 Likes

Thanks for answer! Furthermore, I think there’s undocumented restrictions behavior I’ve discovered that helps with checking out if user has space admin permissions. Turns out if someone is space admin, then “delete” operation is allowed for him even if content is restricted