Skip to content

User Permissions

Attempt to retrieve permissions of a user specified by a user id.

Request

get /users/perms/{id}

Parameters

Parameter Type Required Notes
id Path yes defines id of user

Request body

This endpoint does not have a request body


curl --location 'https://devapi.juno.one/users/perms/308' \
--header 'X-TenantID: development' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZXN0QGp1bm8ub25lIiwidGVuYW50SUQiOiJkZXZlbG9wbWVudCIsImV4cCI6MTY4MjMzOTQwNn0.XWAuQmaKsv5fh60umfYO2gMwtXUjWLWsy6HbDt_fQXV6HPhgQhMkqmmzhWaCXsUP9h-dvKrQowLdqBqHHTYQAA'
import requests

url = "https://devapi.juno.one/users/perms/2"

payload = {}
headers = {
  'X-TenantID': 'development',
  'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZXN0QGp1bm8ub25lIiwidGVuYW50SUQiOiJkZXZlbG9wbWVudCIsImV4cCI6MTY4NDQ4MzYyNn0.cYdUo4oiHnkdAywSAb7EFus9PFg-2FYHZPj4gdMML-mKgUVZw9fewOo4QK6U3PqCzGWjFVksz8HULzyKMnV8AA'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
val client = OkHttpClient()
val request = Request.Builder()
  .url("https://devapi.juno.one/users/perms/2")
  .addHeader("X-TenantID", "development")
  .addHeader("Authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZXN0QGp1bm8ub25lIiwidGVuYW50SUQiOiJkZXZlbG9wbWVudCIsImV4cCI6MTY4NDQ4MzYyNn0.cYdUo4oiHnkdAywSAb7EFus9PFg-2FYHZPj4gdMML-mKgUVZw9fewOo4QK6U3PqCzGWjFVksz8HULzyKMnV8AA")
  .build()
val response = client.newCall(request).execute()

Response

The successful response of get user permissions has the status 200 with the following response body:

{
  "data": {
    "userById": {
      "user": {
        "id": 1,
        "firstname": "test",
        "lastname": "test",
        "description": null,
        "email": "test@juno.one",
        "superadmin": true,
        "language": "en",
        "avatar": "1",
        "teams": [
          {
            "id": 1,
            "name": "demo team",
            "deleted": false,
            "deleted_at": null,
            "created_at": "2021-08-04T10:20:11.000Z",
            "updated_at": "2021-08-04T10:20:11.000Z",
            "roles": [
              {
                "id": 1,
                "name": "demo role",
                "deleted": false,
                "deleted_at": null,
                "created_at": "2021-08-04T10:20:11.000Z",
                "updated_at": "2021-08-04T10:20:11.000Z",
                "perms": [
                  {
                    "id": 1,
                    "module_id": 9,
                    "module_name": "privilege.module.settings",
                    "position": 1,
                    "position_name": "privilege.module.settTeams",
                    "column_id": 1,
                    "disabled": false,
                    "name": "view teams",
                    "description": "privilege.viewTeams",
                    "guard_name": "api",
                    "created_at": "2023-01-16T14:37:21.000Z",
                    "updated_at": "2023-01-16T14:37:21.000Z"
                  }
                ]
              }
            ]
          }
        ]
      },
      "roles": [
        "demo role"
      ],
      "permissions": [
        "view teams"
      ],
      "teams": [
        {
          "id": 1,
          "name": "demo team",
          "deleted": false,
          "deleted_at": null,
          "created_at": "2021-08-04T10:20:11.000Z",
          "updated_at": "2021-08-04T10:20:11.000Z",
          "roles": [
            {
              "id": 1,
              "name": "demo role",
              "deleted": false,
              "deleted_at": null,
              "created_at": "2021-08-04T10:20:11.000Z",
              "updated_at": "2021-08-04T10:20:11.000Z",
              "perms": [
                {
                  "id": 1,
                  "module_id": 9,
                  "module_name": "privilege.module.settings",
                  "position": 1,
                  "position_name": "privilege.module.settTeams",
                  "column_id": 1,
                  "disabled": false,
                  "name": "view teams",
                  "description": "privilege.viewTeams",
                  "guard_name": "api",
                  "created_at": "2023-01-16T14:37:21.000Z",
                  "updated_at": "2023-01-16T14:37:21.000Z"
                }
              ]
            }
          ]
        }
      ]
    },
    "permissionsData": {
      "createPermissions": [
        "create test case"
      ],
      "routePermissions": [
        "view menu dashboard",
        "view menu projects"
      ],
      "projectPermissions": [
        {
          "project": 1,
          "projectPermissions": [
            "edit dashboard",
            "close project"
          ]
        }
      ],
      "otherPermissions": [
        "delete user profile",
        "impersonate user profile"
      ]
    }
  }
}

404 Not found

{
  "timestamp": "2022-02-16T17:11:34.422+00:00",
  "status": 404,
  "error": "Not Found",
  "message": "User with id 30 was not found.",
  "path": "/users/perms/30"
}

406 Insufficient permision.

{
  "timestamp": "2022-02-16T17:11:34.422+00:00",
  "status": 406,
  "error": "Missing permission for action",
  "message": "You do not have a permission for this action",
  "path": "/users/perms/30"
}

500 Unknown error

{
  "timestamp": "2022-02-16T17:11:34.422+00:00",
  "status": 500,
  "error": "Unknown",
  "message": "There was a problem with your request. Please contact your administrator.",
}