As an add-on developer, I want to let Confluence Cloud administrator edit the settings of my add-on if, and only if, they are administrators.
Is there any REST request I can perform to know whether they are admin? Among the ones I've seen in the documentation, there only hacks are available:
A normal request at https://myinstance.atlassian.net/wiki/rest/api/user?username=test1
doesn't return the permissions:
{ type: "known", username: "test1", userKey: "ff808081400000000fe0f0e0ff", profilePicture: {path: "/wiki/images/icons/profilepics/default.png",width: 48,height: 48,isDefault: true}, displayName: "Test 1 [Administrator]", _links: {self: "https://playsql.atlassian.net/wiki/rest/experimental/user?key=ff808081400000000fe0f0e0ff"}, _expandable: {details: ""} }
Thank you
Community moderators have prevented the ability to post new answers.
Although it is difficult to figure out whether a user is admin via the REST API (or the JSON-RPC API for that matter), usually you restrict access in Connect by using Conditions, by which you can hide the entry point to the settings (hide the web-item, or you might be able to also do it for a dialog box?).
In this case, you would specifically use the user_is_admin condition (https://developer.atlassian.com/static/connect/docs/latest/concepts/conditions.html#common-conditions).
If that doesn't work for you, you might be able to do a workaround by creating an additional web-section that is displayed on the same page and which doesn't display any content (set height to 0px) but whose sole purpose is to send an AP.events message to your other iframe that says that the user is admin and is only activated when the user_is_admin condition passes.
This is sad, but it seems to be the right answer. Thank you very much.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.