PublicDashboards: filter by permissions on audit list (#57228)

This commit is contained in:
Ezequiel Victorero
2022-10-19 17:24:00 -03:00
committed by GitHub
parent d81a3e524d
commit 3e6bdf0439
8 changed files with 277 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.12.1. DO NOT EDIT.
// Code generated by mockery v2.14.0. DO NOT EDIT.
package publicdashboards
@@ -15,8 +15,6 @@ import (
publicdashboardsmodels "github.com/grafana/grafana/pkg/services/publicdashboards/models"
testing "testing"
user "github.com/grafana/grafana/pkg/services/user"
)
@@ -228,13 +226,13 @@ func (_m *FakePublicDashboardService) GetQueryDataResponse(ctx context.Context,
return r0, r1
}
// ListPublicDashboards provides a mock function with given fields: ctx, orgId
func (_m *FakePublicDashboardService) ListPublicDashboards(ctx context.Context, orgId int64) ([]publicdashboardsmodels.PublicDashboardListResponse, error) {
ret := _m.Called(ctx, orgId)
// ListPublicDashboards provides a mock function with given fields: ctx, u, orgId
func (_m *FakePublicDashboardService) ListPublicDashboards(ctx context.Context, u *user.SignedInUser, orgId int64) ([]publicdashboardsmodels.PublicDashboardListResponse, error) {
ret := _m.Called(ctx, u, orgId)
var r0 []publicdashboardsmodels.PublicDashboardListResponse
if rf, ok := ret.Get(0).(func(context.Context, int64) []publicdashboardsmodels.PublicDashboardListResponse); ok {
r0 = rf(ctx, orgId)
if rf, ok := ret.Get(0).(func(context.Context, *user.SignedInUser, int64) []publicdashboardsmodels.PublicDashboardListResponse); ok {
r0 = rf(ctx, u, orgId)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]publicdashboardsmodels.PublicDashboardListResponse)
@@ -242,8 +240,8 @@ func (_m *FakePublicDashboardService) ListPublicDashboards(ctx context.Context,
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {
r1 = rf(ctx, orgId)
if rf, ok := ret.Get(1).(func(context.Context, *user.SignedInUser, int64) error); ok {
r1 = rf(ctx, u, orgId)
} else {
r1 = ret.Error(1)
}
@@ -295,8 +293,13 @@ func (_m *FakePublicDashboardService) SavePublicDashboardConfig(ctx context.Cont
return r0, r1
}
// NewFakePublicDashboardService creates a new instance of FakePublicDashboardService. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations.
func NewFakePublicDashboardService(t testing.TB) *FakePublicDashboardService {
type mockConstructorTestingTNewFakePublicDashboardService interface {
mock.TestingT
Cleanup(func())
}
// NewFakePublicDashboardService creates a new instance of FakePublicDashboardService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewFakePublicDashboardService(t mockConstructorTestingTNewFakePublicDashboardService) *FakePublicDashboardService {
mock := &FakePublicDashboardService{}
mock.Mock.Test(t)