mirror of
https://github.com/grafana/grafana.git
synced 2024-11-23 09:26:43 -06:00
Auth: Move Support Bundle service to SignedInUser interface (#72723)
add identity interface for support bundles service
This commit is contained in:
parent
afb59af79b
commit
ba1a8a5634
@ -13,11 +13,11 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/usagestats"
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
"github.com/grafana/grafana/pkg/services/auth/identity"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings"
|
||||
"github.com/grafana/grafana/pkg/services/supportbundles"
|
||||
"github.com/grafana/grafana/pkg/services/supportbundles/bundleregistry"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
)
|
||||
|
||||
@ -109,7 +109,7 @@ func (s *Service) Run(ctx context.Context) error {
|
||||
return ctx.Err()
|
||||
}
|
||||
|
||||
func (s *Service) create(ctx context.Context, collectors []string, usr *user.SignedInUser) (*supportbundles.Bundle, error) {
|
||||
func (s *Service) create(ctx context.Context, collectors []string, usr identity.Requester) (*supportbundles.Bundle, error) {
|
||||
bundle, err := s.store.Create(ctx, usr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -15,8 +15,8 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/kvstore"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/services/auth/identity"
|
||||
"github.com/grafana/grafana/pkg/services/supportbundles"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -41,7 +41,7 @@ type store struct {
|
||||
}
|
||||
|
||||
type bundleStore interface {
|
||||
Create(ctx context.Context, usr *user.SignedInUser) (*supportbundles.Bundle, error)
|
||||
Create(ctx context.Context, usr identity.Requester) (*supportbundles.Bundle, error)
|
||||
Get(ctx context.Context, uid string) (*supportbundles.Bundle, error)
|
||||
StatsCount(ctx context.Context) (int64, error)
|
||||
List() ([]supportbundles.Bundle, error)
|
||||
@ -49,7 +49,7 @@ type bundleStore interface {
|
||||
Update(ctx context.Context, uid string, state supportbundles.State, tarBytes []byte) error
|
||||
}
|
||||
|
||||
func (s *store) Create(ctx context.Context, usr *user.SignedInUser) (*supportbundles.Bundle, error) {
|
||||
func (s *store) Create(ctx context.Context, usr identity.Requester) (*supportbundles.Bundle, error) {
|
||||
uid, err := uuid.NewRandom()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -58,7 +58,7 @@ func (s *store) Create(ctx context.Context, usr *user.SignedInUser) (*supportbun
|
||||
bundle := supportbundles.Bundle{
|
||||
UID: uid.String(),
|
||||
State: supportbundles.StatePending,
|
||||
Creator: usr.Login,
|
||||
Creator: usr.GetLogin(),
|
||||
CreatedAt: time.Now().Unix(),
|
||||
ExpiresAt: time.Now().Add(defaultBundleExpiration).Unix(),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user