Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

Retrieve User Roles

openspecimen/rest/ng/rbac/subjects/{userId}/roles

The API returns the list of roles assigned to the user identified by userId on various sites and collection protocols.

Parameter
Details
userIdUnique ID assigned to every user by OpenSpecimen.


Below is an example of the API call to retrieve user roles.

Method
URL
URLopenspecimen/rest/ng/rbac/subjects/1/roles
MethodGET
Requestapplication/json

Response

[
    {
        "id": 216,
        "role": {
            "id": 5,
            "name": "Tissue Banker",
            "description": "Tissue banker who registers participants and collects specimens.",
            "parentRoleName": null,
            "childRoles": [],
            "acl": [
                {
                    "id": 35,
                    "resourceName": "SurgicalPathologyReport",
                    "operations": [
                        {
                            "operationName": "Delete"
                        },
                        {
                            "operationName": "Read"
                        },
                        {
                            "operationName": "Create"
                        },
                        {
                            "operationName": "Export Import"
                        },
                        {
                            "operationName": "Update"
                        },
                        {
                            "operationName": "Export Import"
                        }
                    ]
                },
                {
                    "id": 47,
                    "resourceName": "StorageContainer",
                    "operations": [
                        {
                            "operationName": "Read"
                        }
                    ]
                },
                {
                    "id": 20,
                    "resourceName": "CollectionProtocol",
                    "operations": [
                        {
                            "operationName": "Read"
                        }
                    ]
                },

                /* Other resources and operations that can be performed on them */
            ]
        },
        "collectionProtocol": null, /* on all CPs of the site Apollo Hospitals */
        "site": {
            "id": 14,
            "name": "AS3",
            "instituteName": "Apollo Hospitals",
            "code": "AS3",

            /* Other site info */
        },
        "systemRole": false
    },

    /* More roles, if any */
]

 Error Cases :

code
Applies to
Status Message
200All resourcesSuccess
400All requestsPermission issues or invalid parameters like incorrect user ID etc
401All requestsAuthorization failed. Requires login.
500All requestsServer error





Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com