openspecimen/rest/ng/rbac/subjects/{userId}/roles/
Use this resource to assign role to user. Use HTTP POST method to call this API by passing the below details in JSON format.
Below are the attributes which need to be sent in the request body:
Parameter | Details |
---|---|
site | Site on which wanted to assign role. Site details in json format. Example : {id: 1, name: "Site1"} |
collectionProtocol | Collection protocol on which wanted to assign role. Collection protocol details in json format. Example: {"title": "Lung cancer protocol", shortTitle: "LCP"} |
role | Role which wanted to assign on given site and cp for user. Role details in json format. Example: {name: "Technician"} |
http[s]:<host>:<port>/openspecimen/rest/ng/rbac/subjects/{userId}/roles/
Use this URL to update user in openSpecimen application.
Result:
The response of this request will contains the details of the updated user.
Below is the example of the update user:
URL | openspecimen/rest/ng/users/1 | |||||||||
Method | PUT | |||||||||
Request | application/json | |||||||||
json | {
| |||||||||
|
Error Cases :
code | Applies to | Status Message |
---|---|---|
200 | All resources | Role has been assigned successfully to user |
400 | All requests | Invalid parameters, e.g site, cp, role etc |
401 | All requests | Authorization failed, user doesn’t have authority to assign role |
404 | All requests | User not found, user with given details not present in the system |
500 | All requests | Internal server error, encountered server error while performing operations |