mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
@@ -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{}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user