Dashboard Extractor: Don't fail when using default OSS implementation (#46024)

* Don't fail when using default OSS implementation

* Check correct error
This commit is contained in:
Selene
2022-03-02 11:04:29 +01:00
committed by GitHub
parent 8e08128f83
commit 5eaf6509c0
5 changed files with 79 additions and 8 deletions

View File

@@ -2,17 +2,20 @@ package permissions
import (
"context"
"errors"
"github.com/grafana/grafana/pkg/models"
)
var ErrNotImplemented = errors.New("not implemented")
type DatasourcePermissionsService interface {
FilterDatasourcesBasedOnQueryPermissions(ctx context.Context, cmd *models.DatasourcesPermissionFilterQuery) error
}
// dummy method
func (hs *OSSDatasourcePermissionsService) FilterDatasourcesBasedOnQueryPermissions(ctx context.Context, cmd *models.DatasourcesPermissionFilterQuery) error {
return nil
return ErrNotImplemented
}
type OSSDatasourcePermissionsService struct{}

View File

@@ -7,12 +7,13 @@ import (
)
type mockDatasourcePermissionService struct {
DsResult []*models.DataSource
DsResult []*models.DataSource
ErrResult error
}
func (m *mockDatasourcePermissionService) FilterDatasourcesBasedOnQueryPermissions(ctx context.Context, cmd *models.DatasourcesPermissionFilterQuery) error {
cmd.Result = m.DsResult
return nil
return m.ErrResult
}
func NewMockDatasourcePermissionService() *mockDatasourcePermissionService {