APIKeys: Add AC controls for legacy API keys (#46255)

* APIKeys: Add AC controls for legacy API keys

* pluralize actions
This commit is contained in:
J Guerreiro
2022-03-04 19:01:03 +01:00
committed by GitHub
parent b47f5433d7
commit 7f1e8cee2b
3 changed files with 36 additions and 4 deletions
+25 -1
View File
@@ -161,6 +161,30 @@ func (hs *HTTPServer) declareFixedRoles() error {
Grants: []string{string(models.ROLE_VIEWER)},
}
apikeyWriterRole := ac.RoleRegistration{
Role: ac.RoleDTO{
Version: 1,
Name: "fixed:apikeys:writer",
DisplayName: "APIKeys writer",
Description: "Gives access to add and delete api keys.",
Group: "API Keys",
Permissions: []ac.Permission{
{
Action: ac.ActionAPIKeyCreate,
},
{
Action: ac.ActionAPIKeyRead,
Scope: ac.ScopeAPIKeysAll,
},
{
Action: ac.ActionAPIKeyDelete,
Scope: ac.ScopeAPIKeysAll,
},
},
},
Grants: []string{"Admin"},
}
orgReaderRole := ac.RoleRegistration{
Role: ac.RoleDTO{
Version: 5,
@@ -366,7 +390,7 @@ func (hs *HTTPServer) declareFixedRoles() error {
datasourcesCompatibilityReaderRole, orgReaderRole, orgWriterRole,
orgMaintainerRole, teamsCreatorRole, teamsWriterRole, datasourcesExplorerRole, annotationsReaderRole,
dashboardsCreatorRole, dashboardsReaderRole, dashboardsWriterRole,
foldersCreatorRole, foldersReaderRole, foldersWriterRole,
foldersCreatorRole, foldersReaderRole, foldersWriterRole, apikeyWriterRole,
)
}