2023-10-10 09:20:52 +02:00
|
|
|
package extsvcaccounts
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/grafana/grafana/pkg/models/roletype"
|
|
|
|
|
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
|
|
|
|
|
)
|
|
|
|
|
|
2023-10-12 16:15:16 +02:00
|
|
|
const (
|
|
|
|
|
kvStoreType = "extsvc-token"
|
|
|
|
|
// #nosec G101 - this is not a hardcoded secret
|
|
|
|
|
tokenNamePrefix = "extsvc-token"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Credentials represents the credentials associated to an external service
|
|
|
|
|
type Credentials struct {
|
|
|
|
|
Secret string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SaveCredentialsCmd struct {
|
|
|
|
|
ExtSvcSlug string
|
|
|
|
|
OrgID int64
|
|
|
|
|
Secret string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type saveCmd struct {
|
2023-10-10 09:20:52 +02:00
|
|
|
ExtSvcSlug string
|
|
|
|
|
OrgID int64
|
|
|
|
|
Permissions []ac.Permission
|
|
|
|
|
SaID int64
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func newRole(r roletype.RoleType) *roletype.RoleType {
|
|
|
|
|
return &r
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func newBool(b bool) *bool {
|
|
|
|
|
return &b
|
|
|
|
|
}
|