Create fixed roles for reading API Keys and service accounts and fix listing of service account tokens (#47767) (#47777)

* Create fixed roles for reading API Keys and service accounts

* Handle PR comments and fix the listing of token

(cherry picked from commit 782ec05d8c)

Co-authored-by: Vardan Torosyan <vardants@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2022-04-18 20:34:12 +02:00
committed by GitHub
co-authored by Vardan Torosyan
parent 8dd16fb871
commit 190766fed1
3 changed files with 40 additions and 5 deletions
+18 -1
View File
@@ -150,6 +150,23 @@ func (hs *HTTPServer) declareFixedRoles() error {
Grants: []string{string(models.ROLE_VIEWER)},
}
apikeyReaderRole := ac.RoleRegistration{
Role: ac.RoleDTO{
Version: 1,
Name: "fixed:apikeys:reader",
DisplayName: "APIKeys reader",
Description: "Gives access to read api keys.",
Group: "API Keys",
Permissions: []ac.Permission{
{
Action: ac.ActionAPIKeyRead,
Scope: ac.ScopeAPIKeysAll,
},
},
},
Grants: []string{string(models.ROLE_ADMIN)},
}
apikeyWriterRole := ac.RoleRegistration{
Role: ac.RoleDTO{
Version: 1,
@@ -411,7 +428,7 @@ func (hs *HTTPServer) declareFixedRoles() error {
orgMaintainerRole, teamsCreatorRole, teamsWriterRole, datasourcesExplorerRole,
annotationsReaderRole, dashboardAnnotationsWriterRole, annotationsWriterRole,
dashboardsCreatorRole, dashboardsReaderRole, dashboardsWriterRole,
foldersCreatorRole, foldersReaderRole, foldersWriterRole, apikeyWriterRole,
foldersCreatorRole, foldersReaderRole, foldersWriterRole, apikeyReaderRole, apikeyWriterRole,
)
}