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

* Create fixed roles for reading API Keys and service accounts

* Handle PR comments and fix the listing of token
This commit is contained in:
Vardan Torosyan
2022-04-14 15:09:55 +02:00
committed by GitHub
parent f79e0c68cc
commit 782ec05d8c
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,
)
}