mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* ServiceAccounts: move token handlers to specific file * ServiceAccounts: move Add API key to Service account * APIKeys: api keys can still be used even when service accounts are enabled * APIKeys: legacy endpoint can't be used to add SA tokens * ServiceAccount: add tests for creation with nil and non-nil service account ids * ServiceAccounts: fix unnasigned cfg and AC typo * Test: test service account token adding * fix linting error * ServiceAccounts: Handle Token deletion * rename token funcs * rename token funcs and api wrapping * add token deletion tests * review Co-authored-by: eleijonmarck <eric.leijonmarck@gmail.com> * remove bus * Update pkg/api/apikey.go Co-authored-by: eleijonmarck <eric.leijonmarck@gmail.com>
25 lines
560 B
Go
25 lines
560 B
Go
package serviceaccounts
|
|
|
|
import "github.com/grafana/grafana/pkg/services/accesscontrol"
|
|
|
|
var (
|
|
ScopeAll = "serviceaccounts:*"
|
|
ScopeID = accesscontrol.Scope("serviceaccounts", "id", accesscontrol.Parameter(":serviceAccountId"))
|
|
)
|
|
|
|
const (
|
|
ActionRead = "serviceaccounts:read"
|
|
ActionWrite = "serviceaccounts:write"
|
|
ActionCreate = "serviceaccounts:create"
|
|
ActionDelete = "serviceaccounts:delete"
|
|
)
|
|
|
|
type ServiceAccount struct {
|
|
Id int64
|
|
}
|
|
|
|
type CreateServiceaccountForm struct {
|
|
OrgID int64 `json:"-"`
|
|
Name string `json:"name" binding:"Required"`
|
|
}
|