mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Accesscontrol update api examples (#37654)
* Fix status, add global flags * Check examples are working, correct where they aren't
This commit is contained in:
@@ -26,10 +26,11 @@ Returns an indicator to check if fine-grained access control is enabled or not.
|
||||
| -------------------- | ---------------------- |
|
||||
| status:accesscontrol | services:accesscontrol |
|
||||
|
||||
|
||||
#### Example request
|
||||
|
||||
```http
|
||||
GET /api/access-control/check
|
||||
GET /api/access-control/status
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
```
|
||||
@@ -61,6 +62,7 @@ Content-Type: application/json; charset=UTF-8
|
||||
|
||||
Refer to the [Role scopes]({{< relref "../enterprise/access-control/roles.md#built-in-role-assignments" >}}) for more information.
|
||||
|
||||
#### Required permissions
|
||||
|
||||
| Action | Scope |
|
||||
| ---------- | -------- |
|
||||
@@ -254,6 +256,7 @@ Content-Type: application/json; charset=UTF-8
|
||||
| Field Name | Data Type | Required | Description |
|
||||
| ---------- | --------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| action | string | Yes | Refer to [Permissions]({{< relref "../enterprise/access-control/permissions.md" >}}) for full list of available actions. |
|
||||
| scope | string | No | If not present, no scope will be mapped to the permission. Refer to [Permissions]({{< relref "../enterprise/access-control/permissions.md#scope-definitions" >}}) for full list of available scopes. |
|
||||
|
||||
#### Example response
|
||||
|
||||
@@ -276,6 +279,7 @@ For example, if a user does not have required permissions for creating users, th
|
||||
### Delete a custom role
|
||||
|
||||
`DELETE /api/access-control/roles/:uid?force=false`
|
||||
|
||||
Delete a role with the given UID, and it's permissions. If the role is assigned to a built-in role, the deletion operation will fail, unless `force` query param is set to `true`, and in that case all assignments will also be deleted.
|
||||
|
||||
#### Required permissions
|
||||
@@ -284,16 +288,17 @@ Accept: application/json
|
||||
For example, if a user does not have required permissions for creating users, they won't be able to delete a custom role which allows to do that.
|
||||
|
||||
| Action | Scope |
|
||||
| roles:delete | permissions:delegate |
|
||||
|
||||
#### Example request
|
||||
| ------------ | -------------------- |
|
||||
| roles:delete | permissions:delegate |
|
||||
|
||||
|
||||
#### Example request
|
||||
|
||||
```http
|
||||
DELETE /api/access-control/roles/jZrmlLCGka?force=true&global=true
|
||||
Accept: application/json
|
||||
|
||||
#### Query parameters
|
||||
```
|
||||
|
||||
#### Query parameters
|
||||
|
||||
| Param | Type | Required | Description |
|
||||
@@ -323,25 +328,27 @@ HTTP/1.1 200 OK
|
||||
|
||||
### Get all built-in role assignments
|
||||
|
||||
|
||||
Gets all built-in role assignments.
|
||||
|
||||
#### Required permissions
|
||||
`GET /api/access-control/builtin-roles`
|
||||
|
||||
Gets all built-in role assignments.
|
||||
|
||||
#### Required permissions
|
||||
|
||||
| Action | Scope |
|
||||
| ------------------ | -------- |
|
||||
| roles.builtin:list | roles:\* |
|
||||
|
||||
| Action | Scope |
|
||||
| ------------------ | -------- |
|
||||
| roles.builtin:list | roles:\* |
|
||||
|
||||
#### Example request
|
||||
|
||||
```http
|
||||
GET /api/access-control/builtin-roles
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
|
||||
```http
|
||||
GET /api/access-control/builtin-roles
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
#### Example response
|
||||
|
||||
#### Example response
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
|
||||
@@ -370,10 +377,11 @@ For example, if a user does not have required permissions for creating users, th
|
||||
| ----------------- | -------------------- |
|
||||
| roles.builtin:add | permissions:delegate |
|
||||
|
||||
#### Example request
|
||||
|
||||
```http
|
||||
POST /api/access-control/builtin-roles
|
||||
```http
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
|
Reference in New Issue
Block a user