Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

In Connect, is it possible to see a user's groups and/or permissions?

Adrien Ragot 2
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 28, 2015

Hi,

I've read the page of Atlassian Connect about REST APIs in Confluence. I've tried several of those APIs but I can't succeed to get enough information about users.

I'd like to get:

  • A user's permissions (admin and whether he's admin/editor/viewer of the current space), so I can disclose only information of the spaces they're allowed to see.
  • If it's not possible, can we at least see a user's groups, so I could create a config screen where users manage permissions using groups.

It seems the official way is just to access REST resources on behalf of the user, and we'll be told whether it's 403-Forbidden or not. It integrate well if the add-on hosts and serves data.

FYI, here's the JSON I get for http://localhost:1990/confluence/rest/prototype/1/search/user?query=admin

{
  "totalSize": 1,
  "result": [
    {
      "id": "589825",
      "type": "user",
      "title": "admin",
      "wikiLink": "[~admin]",
      "createdDate": {
        "friendly": "Jan 06, 2012",
        "date": "2012-01-06T13:33:40+0100"
      },
      "creator": {
        "links": [
          {
            "href": "http://localhost:1990/confluence/rest/prototype/1/user/system/anonymous",
            "rel": "self"
          }
        ],
        "avatarUrl": "/confluence/s/en_GB/5780/NOCACHE1/_/images/icons/profilepics/anonymous.png",
        "anonymous": true,
        "displayName": "Anonymous"
      },
      "lastModifier": {
        "links": [
          {
            "href": "http://localhost:1990/confluence/rest/prototype/1/user/system/anonymous",
            "rel": "self"
          }
        ],
        "avatarUrl": "/confluence/s/en_GB/5780/NOCACHE1/_/images/icons/profilepics/anonymous.png",
        "anonymous": true,
        "displayName": "Anonymous"
      },
      "username": "admin",
      "userKey": "8a8082a04ed4a5f8014ed4a60a610003",
      "thumbnailLink": {
        "href": "http://localhost:1990/confluence/images/icons/profilepics/default.png",
        "type": "image/png",
        "rel": "thumbnail"
      },
      "link": [
        {
          "href": "http://localhost:1990/confluence/display/~admin",
          "type": "text/html",
          "rel": "alternate"
        },
        {
          "href": "http://localhost:1990/confluence/spaces/flyingpdf/pdfpageexport.action?pageId=589825",
          "type": "application/pdf",
          "rel": "alternate"
        },
        {
          "href": "http://localhost:1990/confluence/rest/prototype/1/content/589825",
          "rel": "self"
        }
      ]
    }
  ],
  "group": []
}


 

 

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Travis Smith
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 28, 2015

If you access the REST resources from within an iframe, using AP.request, it will be as the current user. 

You may also want to look at conditions, which include things such as user_is_admin

If you feel like your usecase is not covered by these options, you can open up request for that. 

peterb
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 28, 2015

This is the list of white-listed JIRA REST API endpoints: https://developer.atlassian.com/static/connect/docs/latest/scopes/jira-rest-scopes.html

Adrien Ragot 2
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 18, 2015

Peter, the link you provide is provided in my question, as the 2nd word, after "Hi".

peterb
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 18, 2015

Ah yes, so it is. Also, administrators can change permissions on a whim at any moment, so you do need to handle 403 rejections.

TAGS
AUG Leaders

Atlassian Community Events