So here’s what I’m trying to achieve: A space owner in confluence should be able to decide whether the functionality of our plugin is available to users in that specific space.
We’ve got a little UI for that (just a toggle button to turn the functionality on or off in the space preferences). Now in order for that button to actually display and be able to change the value, I added a rest module that allows us to get or set this permission in the Java Class.
This works fine, but I have to problems with this approach:
1: Now every user would be able to change or view this permission value with a simple URL query. And I don’t know how adding authentication to that rest module would work.
2: This seems unnecessarily complicated for such a simple task. Is there an easier way to do this?
I’d be grateful for any kind of help!
Thanks, Jonas
You have to check server sided, if the current user is a space admin in the current space (I assume the space key is a request param). The SpacePermissionManager is a way to check that
Thanks! I appreciate the help. We’re doing this as a college project so none of us are super experienced with Confluence and it can be a little confusing at times.
Also IntelliJ doesn’t accept ConfluenceUser as a parameter for the user in hasPermission(), only a User object even though ConfluenceUser extends User. It just tells me “cannot resolve method hasPermission()…” When I use the deprecated getUser() it works fine. Any idea why this could be happening?