API: Restrict anonymous user information access (#18422)
Existing /api/alert-notifications now requires at least editor access. Existing /api/alert-notifiers now requires at least editor access. New /api/alert-notifications/lookup returns less information than /api/alert-notifications and can be access by any authenticated user. Existing /api/org/users now requires org admin role. New /api/org/users/lookup returns less information than /api/org/users and can be access by users that are org admins, admin in any folder or admin of any team. UserPicker component now uses /api/org/users/lookup instead of /api/org/users. Fixes #17318
This commit is contained in:
@@ -63,6 +63,48 @@ Content-Type: application/json
|
||||
|
||||
```
|
||||
|
||||
## Get all notification channels (lookup)
|
||||
|
||||
Returns all notification channels, but with less detailed information.
|
||||
Accessible by any authenticated user and is mainly used by providing
|
||||
alert notification channels in Grafana UI when configuring alert rule.
|
||||
|
||||
`GET /api/alert-notifications/lookup`
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/alert-notifications/lookup HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"uid": "000000001",
|
||||
"name": "Test",
|
||||
"type": "email",
|
||||
"isDefault": false
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"uid": "000000002",
|
||||
"name": "Slack",
|
||||
"type": "slack",
|
||||
"isDefault": false
|
||||
}
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
## Get notification channel by uid
|
||||
|
||||
`GET /api/alert-notifications/uid/:uid`
|
||||
|
||||
Reference in New Issue
Block a user