-
Notifications
You must be signed in to change notification settings - Fork 13
Roles
The Roles resource provide methods to read and write roles as well as associate permissions to roles.
This method allows client applications to retrieve a list of roles based on a grain, securableItem and optionally a role name. This is not a user specific endpoint and will return all roles for that grain/securableItem/{permissionName} combination regardless of user.
GET /roles/{grain}/{securableItem}
GET /roles/{grain}/{securableItem}/{roleName}
| Name | Location | Type | Description |
|---|---|---|---|
| grain | path | string | The top level grain to return roles for |
| securableItem | path | string | the specific securableItem within the grain to return roles for |
| roleName | path | string | the name of the role |
This request requires authorization with the following scopes:
fabric/authorization.read
Do not supply a request body with this method
[
{
"id": guid,
"grain": string,
"securableItem": string,
"name": string,
"permissions": [
{
"id": guid,
"grain": string,
"securableItem": string,
"name": string
}
]
}
]
A Forbidden response will be returned in the following cases:
- If the requested grain/securableItem does not match the clientid presented
- If the access token can not be validated (i.e. is forged or doesn't have the correct scope)
This method allows clients to add roles to the Authorization service store.
POST /roles/
| Name | Location | Type | Description |
|---|---|---|---|
| None | N/A | N/A | N/A |
This request requires authorization with the following scopes:
fabric/authorization.write
{
"grain": string,
"securableItem": string,
"name": string
}
A 201 created response will be returned if the role is successfully created.
A 400 Bad Request will be returned in the following cases:
- If the request is malformed
- If the role already exists
A Forbidden response will be returned in the following cases:
- If the requested grain/securableItem does not match the clientid presented
- If the access token can not be validated (i.e. is forged or doesn't have the correct scope)
This method allows clients to add permissions to roles that exist in the Authorization service store.
POST /roles/{roleId}/permissions
| Name | Location | Type | Description |
|---|---|---|---|
| roleId | path | guid | The unique identifier for the role to add the permissions to |
This request requires authorization with the following scopes:
fabric/authorization.write
[
{
"id": guid,
"grain": string,
"securableItem": string,
"name": string
}
]
A 204 No Content response will be returned if the permissions are added to the role successfully.
A 400 Bad Request will be returned in the following cases:
- If the request is malformed
- If the role doesn't exist
- If the permission already exists on the role
A Forbidden response will be returned in the following cases:
- If the requested grain/securableItem does not match the clientid presented
- If the access token can not be validated (i.e. is forged or doesn't have the correct scope)
DELETE /roles/{roleId}
| Name | Location | Type | Description |
|---|---|---|---|
| roleId | path | guid | The unique identifier for the role to delete |
This request requires authorization with the following scopes:
fabric/authorization.write
Do not supply a request body with this method
A 204 no content response will be returned if the role is successfully deleted.
A 400 Bad Request respons will be returned in the following cases:
- The role being deleted does not exist in the Authorization service data store
- The request is malformed
A Forbidden response will be returned in the following cases:
- If the requested grain/securableItem does not match the clientid presented
- If the access token can not be validated (i.e. is forged or doesn't have the correct scope)
This method allows clients to delete permissions from a role that exist in the Authorization service store.
DELETE /roles/{roleId}/permissions
| Name | Location | Type | Description |
|---|---|---|---|
| roleId | path | guid | The unique identifier for the role to delete the permissions from |
This request requires authorization with the following scopes:
fabric/authorization.write
[
{
"id": guid,
"grain": string,
"securableItem": string,
"name": string
}
]
A 204 No Content response will be returned if the permissions are deleted from the role successfully.
A 400 Bad Request will be returned in the following cases:
- If the request is malformed
- If the role doesn't exist
- If the permission and role grain/securableItem combination don't match
- If the permission doesn't exist on the role
A Forbidden response will be returned in the following cases:
- If the requested grain/securableItem does not match the clientid presented
- If the access token can not be validated (i.e. is forged or doesn't have the correct scope)