2021-11-11 09:10:24 -06:00
|
|
|
package serviceaccounts
|
|
|
|
|
2022-02-08 07:31:34 -06:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2022-02-17 06:19:58 -06:00
|
|
|
"github.com/grafana/grafana/pkg/models"
|
2022-02-08 07:31:34 -06:00
|
|
|
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
|
|
|
)
|
2021-11-11 09:10:24 -06:00
|
|
|
|
|
|
|
var (
|
|
|
|
ScopeAll = "serviceaccounts:*"
|
2022-02-07 07:51:54 -06:00
|
|
|
ScopeID = accesscontrol.Scope("serviceaccounts", "id", accesscontrol.Parameter(":serviceAccountId"))
|
2021-11-11 09:10:24 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2021-11-19 05:39:50 -06:00
|
|
|
ActionRead = "serviceaccounts:read"
|
|
|
|
ActionWrite = "serviceaccounts:write"
|
|
|
|
ActionCreate = "serviceaccounts:create"
|
2021-11-11 09:10:24 -06:00
|
|
|
ActionDelete = "serviceaccounts:delete"
|
|
|
|
)
|
2021-12-14 07:39:25 -06:00
|
|
|
|
|
|
|
type ServiceAccount struct {
|
|
|
|
Id int64
|
|
|
|
}
|
|
|
|
|
2022-02-17 06:19:58 -06:00
|
|
|
type UpdateServiceAccountForm struct {
|
|
|
|
Name *string `json:"name"`
|
|
|
|
Role *models.RoleType `json:"role"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type CreateServiceAccountForm struct {
|
2022-02-07 07:12:39 -06:00
|
|
|
OrgID int64 `json:"-"`
|
|
|
|
Name string `json:"name" binding:"Required"`
|
2021-12-14 07:39:25 -06:00
|
|
|
}
|
2022-02-08 07:31:34 -06:00
|
|
|
|
|
|
|
type ServiceAccountDTO struct {
|
2022-02-08 13:19:22 -06:00
|
|
|
Id int64 `json:"id"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Login string `json:"login"`
|
|
|
|
OrgId int64 `json:"orgId"`
|
|
|
|
Tokens int64 `json:"tokens"`
|
|
|
|
Role string `json:"role"`
|
|
|
|
AvatarUrl string `json:"avatarUrl"`
|
|
|
|
AccessControl map[string]bool `json:"accessControl,omitempty"`
|
2022-02-08 07:31:34 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type ServiceAccountProfileDTO struct {
|
|
|
|
Id int64 `json:"id"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Login string `json:"login"`
|
|
|
|
OrgId int64 `json:"orgId"`
|
|
|
|
IsDisabled bool `json:"isDisabled"`
|
|
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
|
|
AvatarUrl string `json:"avatarUrl"`
|
2022-02-25 04:33:34 -06:00
|
|
|
Role string `json:"role"`
|
|
|
|
Teams []string `json:"teams"`
|
2022-02-08 07:31:34 -06:00
|
|
|
AccessControl map[string]bool `json:"accessControl,omitempty"`
|
|
|
|
}
|