check that the user has RBAC permissions to save dashboard annotation (#47882) (#47920)

(cherry picked from commit 1588cd393a)

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2022-04-20 10:49:32 +02:00
committed by GitHub
co-authored by Ieva
parent 5de766a202
commit b53f5675f4
2 changed files with 46 additions and 54 deletions
+12
View File
@@ -615,6 +615,18 @@ func TestAPI_Annotations_AccessControl(t *testing.T) {
},
want: http.StatusForbidden,
},
{
name: "AccessControl create dashboard annotation with incorrect permissions is forbidden",
args: args{
permissions: []*accesscontrol.Permission{{
Action: accesscontrol.ActionAnnotationsCreate, Scope: accesscontrol.ScopeAnnotationsTypeOrganization,
}},
url: "/api/annotations",
method: http.MethodPost,
body: mockRequestBody(postDashboardCmd),
},
want: http.StatusForbidden,
},
{
name: "AccessControl create organization annotation with permissions is allowed",
args: args{