atlassian-api / atlassian-python-api

Atlassian Python REST API wrapper
https://atlassian-python-api.readthedocs.io
Apache License 2.0
1.29k stars 642 forks source link

API method to check if a user has permission on a specific page/space #1366

Open amitjoy opened 2 months ago

amitjoy commented 2 months ago

I am currently looking for an API which would return if another user has READ permission on a specific space/page. I stumbled upon /wiki/rest/api/content/{id}/permission/check [1] which I think could be used for my scenario. However, I could not find any API method in the library to verify my assumption though.

[1] - https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content-permissions/#api-group-content-permissions

gkowalc commented 2 months ago

hmm it would be indeed a nice addition to the library. From what I see in the docs above endpoint is not listed in v2 version of the API (which should be used now - https://developer.atlassian.com/cloud/confluence/rest/v2/intro/#auth). There is however api endpoint for space permission https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-space-permissions/#api-group-space-permissions.

It is possible that v1 endpoint for wiki/rest/api/content/{id}/permission/check still works, but adding a new library method to v1 is a bit risky from our perspective (it can be deprecated at any point). Let me check with atlassian if they are planning to add contnent permissions endpoints to v2 api.

amitjoy commented 2 months ago

@gkowalc Thanks a lot for your quick feedback. The space permission is the new addition in v2 which was missing in v1. That's why, possibly this v1 API endpoint has been removed but to be frank, the new v2 endpoint cannot replace the v1 endpoint since we still cannot figure out if any user has a specific permission (e.g. READ) on a specific space or a page. That's why, it would really be nice to have an endpoint for this purpose.