mirror of
https://github.com/grafana/grafana.git
synced 2025-01-02 12:17:01 -06:00
6afad51761
* Move SignedInUser to user service and RoleType and Roles to org * Use go naming convention for roles * Fix some imports and leftovers * Fix ldap debug test * Fix lint * Fix lint 2 * Fix lint 3 * Fix type and not needed conversion * Clean up messages in api tests * Clean up api tests 2
28 lines
825 B
Go
28 lines
825 B
Go
package permissions
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/grafana/grafana/pkg/services/datasources"
|
|
"github.com/grafana/grafana/pkg/services/user"
|
|
)
|
|
|
|
type mockDatasourcePermissionService struct {
|
|
DsResult []*datasources.DataSource
|
|
DsUidResult []string
|
|
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) error {
|
|
cmd.Result = m.DsResult
|
|
return m.ErrResult
|
|
}
|
|
|
|
func NewMockDatasourcePermissionService() *mockDatasourcePermissionService {
|
|
return &mockDatasourcePermissionService{}
|
|
}
|