mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 10:50:37 -06:00
parent
3150d80428
commit
7871052899
@ -5,14 +5,12 @@ import (
|
||||
"errors"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/datasources"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
)
|
||||
|
||||
var ErrNotImplemented = errors.New("not implemented")
|
||||
|
||||
type DatasourcePermissionsService interface {
|
||||
FilterDatasourcesBasedOnQueryPermissions(ctx context.Context, cmd *datasources.DatasourcesPermissionFilterQuery) ([]*datasources.DataSource, error)
|
||||
FilterDatasourceUidsBasedOnQueryPermissions(ctx context.Context, user *user.SignedInUser, datasourceUids []string) ([]string, error)
|
||||
}
|
||||
|
||||
// dummy method
|
||||
@ -20,10 +18,6 @@ func (hs *OSSDatasourcePermissionsService) FilterDatasourcesBasedOnQueryPermissi
|
||||
return nil, ErrNotImplemented
|
||||
}
|
||||
|
||||
func (hs *OSSDatasourcePermissionsService) FilterDatasourceUidsBasedOnQueryPermissions(ctx context.Context, user *user.SignedInUser, datasourceUids []string) ([]string, error) {
|
||||
return nil, ErrNotImplemented
|
||||
}
|
||||
|
||||
type OSSDatasourcePermissionsService struct{}
|
||||
|
||||
func ProvideDatasourcePermissionsService() *OSSDatasourcePermissionsService {
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/datasources"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
)
|
||||
|
||||
type mockDatasourcePermissionService struct {
|
||||
@ -13,10 +12,6 @@ type mockDatasourcePermissionService struct {
|
||||
ErrResult error
|
||||
}
|
||||
|
||||
func (m *mockDatasourcePermissionService) FilterDatasourceUidsBasedOnQueryPermissions(ctx context.Context, user *user.SignedInUser, datasourceUids []string) ([]string, error) {
|
||||
return m.DsUidResult, m.ErrResult
|
||||
}
|
||||
|
||||
func (m *mockDatasourcePermissionService) FilterDatasourcesBasedOnQueryPermissions(ctx context.Context, cmd *datasources.DatasourcesPermissionFilterQuery) ([]*datasources.DataSource, error) {
|
||||
return m.DsResult, m.ErrResult
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user