Service account: Ensure that you can revert only service accounts which you can access (#52626)

* Service account: Ensure that you can revert only service accounts which you can access

* Remove prettier messup with docs

* Remove prettier messup with docs

* Prettier run
This commit is contained in:
Vardan Torosyan
2022-07-22 10:35:01 +02:00
committed by GitHub
parent 5d05d26e12
commit 18867d6d78
7 changed files with 69 additions and 38 deletions

View File

@@ -138,9 +138,9 @@ Content-Type: application/json
---
## Get service account tokens
`GET /api/serviceaccounts/:id/tokens`
## Get service account tokens
`GET /api/serviceaccounts/:id/tokens`
**Required permissions**
@@ -179,9 +179,9 @@ Content-Type: application/json
| --------------------- | --------------------- |
| serviceaccounts:write | serviceaccounts:id:\* |
**Example Request**:
```http
**Example Request**:
```http
POST /api/serviceaccounts/2/tokens HTTP/1.1
Accept: application/json
Content-Type: application/json
@@ -227,9 +227,9 @@ Content-Type: application/json
```
## Revert service account token to API key
`DELETE /api/serviceaccounts/revert/:keyId`
`DELETE /api/serviceaccounts/:serviceAccountId/revert/:keyId`
This operation will delete the service account and create a legacy API Key for the given `keyId`.
**Required permissions**
@@ -267,9 +267,9 @@ Content-Type: application/json
See note in the [introduction]({{< ref "#service-account-api" >}}) for an explanation.
| Action | Scope |
| --------------------- | -------------------- |
| serviceaccounts:write | serviceaccounts:id:1 |
| Action | Scope |
| --------------------- | --------------------- |
| serviceaccounts:write | serviceaccounts:id:\* |
**Example Request**:
@@ -306,9 +306,9 @@ Content-Type: application/json
See note in the [introduction]({{< ref "#service-account-api" >}}) for an explanation.
| Action | Scope |
| --------------------- | -------------------- |
| serviceaccounts:write | serviceaccounts:id:1 |
| Action | Scope |
| --------------------- | --------------------- |
| serviceaccounts:write | serviceaccounts:id:\* |
**Example Request**:
@@ -332,7 +332,7 @@ Content-Type: application/json
## Revert service account token to API key
`DELETE /api/serviceaccounts/revert/:keyId`
`DELETE /api/serviceaccounts/:serviceAccountId/revert/:keyId`
This operation will delete the service account and create a legacy API Key for the given `keyId`.
@@ -340,14 +340,14 @@ This operation will delete the service account and create a legacy API Key for t
See note in the [introduction]({{< ref "#service-account-api" >}}) for an explanation.
| Action | Scope |
| ---------------------- | ----- |
| serviceaccounts:delete | n/a |
| Action | Scope |
| ---------------------- | --------------------- |
| serviceaccounts:delete | serviceaccounts:id:\* |
**Example Request**:
```http
DELETE /api/serviceaccounts/revert/glsa_VVQjot0nijQ59lun6pMZRtsdBXxnFQ9M_77c34a79 HTTP/1.1
DELETE /api/serviceaccounts/1/revert/glsa_VVQjot0nijQ59lun6pMZRtsdBXxnFQ9M_77c34a79 HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Basic YWRtaW46YWRtaW4=