mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-23 12:38:21 -05:00
96e59598d3
When filtering by role assignment we now populate the 'appRoleAssignments' property of the returned users when the incoming request contained and '$expand=appRoleAssignments'. This avoids having to query the role assignments for all users in the result set a second time. The effect of this optimization depends a lot on the actual setup. In single binary all-in-one installations it is rather small (this it saves quite a few CPU cycles). In distributed setup it should be larger as it reduces the number of network round trips to the settings service significantly.
413 lines
14 KiB
Go
413 lines
14 KiB
Go
// Code generated by mockery v2.40.2. DO NOT EDIT.
|
|
|
|
package mocks
|
|
|
|
import (
|
|
context "context"
|
|
|
|
client "go-micro.dev/v4/client"
|
|
|
|
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
v0 "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0"
|
|
)
|
|
|
|
// RoleService is an autogenerated mock type for the RoleService type
|
|
type RoleService struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type RoleService_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *RoleService) EXPECT() *RoleService_Expecter {
|
|
return &RoleService_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// AssignRoleToUser provides a mock function with given fields: ctx, in, opts
|
|
func (_m *RoleService) AssignRoleToUser(ctx context.Context, in *v0.AssignRoleToUserRequest, opts ...client.CallOption) (*v0.AssignRoleToUserResponse, error) {
|
|
_va := make([]interface{}, len(opts))
|
|
for _i := range opts {
|
|
_va[_i] = opts[_i]
|
|
}
|
|
var _ca []interface{}
|
|
_ca = append(_ca, ctx, in)
|
|
_ca = append(_ca, _va...)
|
|
ret := _m.Called(_ca...)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for AssignRoleToUser")
|
|
}
|
|
|
|
var r0 *v0.AssignRoleToUserResponse
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *v0.AssignRoleToUserRequest, ...client.CallOption) (*v0.AssignRoleToUserResponse, error)); ok {
|
|
return rf(ctx, in, opts...)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *v0.AssignRoleToUserRequest, ...client.CallOption) *v0.AssignRoleToUserResponse); ok {
|
|
r0 = rf(ctx, in, opts...)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*v0.AssignRoleToUserResponse)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *v0.AssignRoleToUserRequest, ...client.CallOption) error); ok {
|
|
r1 = rf(ctx, in, opts...)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// RoleService_AssignRoleToUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AssignRoleToUser'
|
|
type RoleService_AssignRoleToUser_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// AssignRoleToUser is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - in *v0.AssignRoleToUserRequest
|
|
// - opts ...client.CallOption
|
|
func (_e *RoleService_Expecter) AssignRoleToUser(ctx interface{}, in interface{}, opts ...interface{}) *RoleService_AssignRoleToUser_Call {
|
|
return &RoleService_AssignRoleToUser_Call{Call: _e.mock.On("AssignRoleToUser",
|
|
append([]interface{}{ctx, in}, opts...)...)}
|
|
}
|
|
|
|
func (_c *RoleService_AssignRoleToUser_Call) Run(run func(ctx context.Context, in *v0.AssignRoleToUserRequest, opts ...client.CallOption)) *RoleService_AssignRoleToUser_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
variadicArgs := make([]client.CallOption, len(args)-2)
|
|
for i, a := range args[2:] {
|
|
if a != nil {
|
|
variadicArgs[i] = a.(client.CallOption)
|
|
}
|
|
}
|
|
run(args[0].(context.Context), args[1].(*v0.AssignRoleToUserRequest), variadicArgs...)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *RoleService_AssignRoleToUser_Call) Return(_a0 *v0.AssignRoleToUserResponse, _a1 error) *RoleService_AssignRoleToUser_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *RoleService_AssignRoleToUser_Call) RunAndReturn(run func(context.Context, *v0.AssignRoleToUserRequest, ...client.CallOption) (*v0.AssignRoleToUserResponse, error)) *RoleService_AssignRoleToUser_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// ListRoleAssignments provides a mock function with given fields: ctx, in, opts
|
|
func (_m *RoleService) ListRoleAssignments(ctx context.Context, in *v0.ListRoleAssignmentsRequest, opts ...client.CallOption) (*v0.ListRoleAssignmentsResponse, error) {
|
|
_va := make([]interface{}, len(opts))
|
|
for _i := range opts {
|
|
_va[_i] = opts[_i]
|
|
}
|
|
var _ca []interface{}
|
|
_ca = append(_ca, ctx, in)
|
|
_ca = append(_ca, _va...)
|
|
ret := _m.Called(_ca...)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ListRoleAssignments")
|
|
}
|
|
|
|
var r0 *v0.ListRoleAssignmentsResponse
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListRoleAssignmentsRequest, ...client.CallOption) (*v0.ListRoleAssignmentsResponse, error)); ok {
|
|
return rf(ctx, in, opts...)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListRoleAssignmentsRequest, ...client.CallOption) *v0.ListRoleAssignmentsResponse); ok {
|
|
r0 = rf(ctx, in, opts...)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*v0.ListRoleAssignmentsResponse)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *v0.ListRoleAssignmentsRequest, ...client.CallOption) error); ok {
|
|
r1 = rf(ctx, in, opts...)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// RoleService_ListRoleAssignments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRoleAssignments'
|
|
type RoleService_ListRoleAssignments_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// ListRoleAssignments is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - in *v0.ListRoleAssignmentsRequest
|
|
// - opts ...client.CallOption
|
|
func (_e *RoleService_Expecter) ListRoleAssignments(ctx interface{}, in interface{}, opts ...interface{}) *RoleService_ListRoleAssignments_Call {
|
|
return &RoleService_ListRoleAssignments_Call{Call: _e.mock.On("ListRoleAssignments",
|
|
append([]interface{}{ctx, in}, opts...)...)}
|
|
}
|
|
|
|
func (_c *RoleService_ListRoleAssignments_Call) Run(run func(ctx context.Context, in *v0.ListRoleAssignmentsRequest, opts ...client.CallOption)) *RoleService_ListRoleAssignments_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
variadicArgs := make([]client.CallOption, len(args)-2)
|
|
for i, a := range args[2:] {
|
|
if a != nil {
|
|
variadicArgs[i] = a.(client.CallOption)
|
|
}
|
|
}
|
|
run(args[0].(context.Context), args[1].(*v0.ListRoleAssignmentsRequest), variadicArgs...)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *RoleService_ListRoleAssignments_Call) Return(_a0 *v0.ListRoleAssignmentsResponse, _a1 error) *RoleService_ListRoleAssignments_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *RoleService_ListRoleAssignments_Call) RunAndReturn(run func(context.Context, *v0.ListRoleAssignmentsRequest, ...client.CallOption) (*v0.ListRoleAssignmentsResponse, error)) *RoleService_ListRoleAssignments_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// ListRoleAssignmentsFiltered provides a mock function with given fields: ctx, in, opts
|
|
func (_m *RoleService) ListRoleAssignmentsFiltered(ctx context.Context, in *v0.ListRoleAssignmentsFilteredRequest, opts ...client.CallOption) (*v0.ListRoleAssignmentsResponse, error) {
|
|
_va := make([]interface{}, len(opts))
|
|
for _i := range opts {
|
|
_va[_i] = opts[_i]
|
|
}
|
|
var _ca []interface{}
|
|
_ca = append(_ca, ctx, in)
|
|
_ca = append(_ca, _va...)
|
|
ret := _m.Called(_ca...)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ListRoleAssignmentsFiltered")
|
|
}
|
|
|
|
var r0 *v0.ListRoleAssignmentsResponse
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListRoleAssignmentsFilteredRequest, ...client.CallOption) (*v0.ListRoleAssignmentsResponse, error)); ok {
|
|
return rf(ctx, in, opts...)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListRoleAssignmentsFilteredRequest, ...client.CallOption) *v0.ListRoleAssignmentsResponse); ok {
|
|
r0 = rf(ctx, in, opts...)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*v0.ListRoleAssignmentsResponse)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *v0.ListRoleAssignmentsFilteredRequest, ...client.CallOption) error); ok {
|
|
r1 = rf(ctx, in, opts...)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// RoleService_ListRoleAssignmentsFiltered_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRoleAssignmentsFiltered'
|
|
type RoleService_ListRoleAssignmentsFiltered_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// ListRoleAssignmentsFiltered is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - in *v0.ListRoleAssignmentsFilteredRequest
|
|
// - opts ...client.CallOption
|
|
func (_e *RoleService_Expecter) ListRoleAssignmentsFiltered(ctx interface{}, in interface{}, opts ...interface{}) *RoleService_ListRoleAssignmentsFiltered_Call {
|
|
return &RoleService_ListRoleAssignmentsFiltered_Call{Call: _e.mock.On("ListRoleAssignmentsFiltered",
|
|
append([]interface{}{ctx, in}, opts...)...)}
|
|
}
|
|
|
|
func (_c *RoleService_ListRoleAssignmentsFiltered_Call) Run(run func(ctx context.Context, in *v0.ListRoleAssignmentsFilteredRequest, opts ...client.CallOption)) *RoleService_ListRoleAssignmentsFiltered_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
variadicArgs := make([]client.CallOption, len(args)-2)
|
|
for i, a := range args[2:] {
|
|
if a != nil {
|
|
variadicArgs[i] = a.(client.CallOption)
|
|
}
|
|
}
|
|
run(args[0].(context.Context), args[1].(*v0.ListRoleAssignmentsFilteredRequest), variadicArgs...)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *RoleService_ListRoleAssignmentsFiltered_Call) Return(_a0 *v0.ListRoleAssignmentsResponse, _a1 error) *RoleService_ListRoleAssignmentsFiltered_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *RoleService_ListRoleAssignmentsFiltered_Call) RunAndReturn(run func(context.Context, *v0.ListRoleAssignmentsFilteredRequest, ...client.CallOption) (*v0.ListRoleAssignmentsResponse, error)) *RoleService_ListRoleAssignmentsFiltered_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// ListRoles provides a mock function with given fields: ctx, in, opts
|
|
func (_m *RoleService) ListRoles(ctx context.Context, in *v0.ListBundlesRequest, opts ...client.CallOption) (*v0.ListBundlesResponse, error) {
|
|
_va := make([]interface{}, len(opts))
|
|
for _i := range opts {
|
|
_va[_i] = opts[_i]
|
|
}
|
|
var _ca []interface{}
|
|
_ca = append(_ca, ctx, in)
|
|
_ca = append(_ca, _va...)
|
|
ret := _m.Called(_ca...)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ListRoles")
|
|
}
|
|
|
|
var r0 *v0.ListBundlesResponse
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListBundlesRequest, ...client.CallOption) (*v0.ListBundlesResponse, error)); ok {
|
|
return rf(ctx, in, opts...)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListBundlesRequest, ...client.CallOption) *v0.ListBundlesResponse); ok {
|
|
r0 = rf(ctx, in, opts...)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*v0.ListBundlesResponse)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *v0.ListBundlesRequest, ...client.CallOption) error); ok {
|
|
r1 = rf(ctx, in, opts...)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// RoleService_ListRoles_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRoles'
|
|
type RoleService_ListRoles_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// ListRoles is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - in *v0.ListBundlesRequest
|
|
// - opts ...client.CallOption
|
|
func (_e *RoleService_Expecter) ListRoles(ctx interface{}, in interface{}, opts ...interface{}) *RoleService_ListRoles_Call {
|
|
return &RoleService_ListRoles_Call{Call: _e.mock.On("ListRoles",
|
|
append([]interface{}{ctx, in}, opts...)...)}
|
|
}
|
|
|
|
func (_c *RoleService_ListRoles_Call) Run(run func(ctx context.Context, in *v0.ListBundlesRequest, opts ...client.CallOption)) *RoleService_ListRoles_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
variadicArgs := make([]client.CallOption, len(args)-2)
|
|
for i, a := range args[2:] {
|
|
if a != nil {
|
|
variadicArgs[i] = a.(client.CallOption)
|
|
}
|
|
}
|
|
run(args[0].(context.Context), args[1].(*v0.ListBundlesRequest), variadicArgs...)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *RoleService_ListRoles_Call) Return(_a0 *v0.ListBundlesResponse, _a1 error) *RoleService_ListRoles_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *RoleService_ListRoles_Call) RunAndReturn(run func(context.Context, *v0.ListBundlesRequest, ...client.CallOption) (*v0.ListBundlesResponse, error)) *RoleService_ListRoles_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// RemoveRoleFromUser provides a mock function with given fields: ctx, in, opts
|
|
func (_m *RoleService) RemoveRoleFromUser(ctx context.Context, in *v0.RemoveRoleFromUserRequest, opts ...client.CallOption) (*emptypb.Empty, error) {
|
|
_va := make([]interface{}, len(opts))
|
|
for _i := range opts {
|
|
_va[_i] = opts[_i]
|
|
}
|
|
var _ca []interface{}
|
|
_ca = append(_ca, ctx, in)
|
|
_ca = append(_ca, _va...)
|
|
ret := _m.Called(_ca...)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for RemoveRoleFromUser")
|
|
}
|
|
|
|
var r0 *emptypb.Empty
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *v0.RemoveRoleFromUserRequest, ...client.CallOption) (*emptypb.Empty, error)); ok {
|
|
return rf(ctx, in, opts...)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *v0.RemoveRoleFromUserRequest, ...client.CallOption) *emptypb.Empty); ok {
|
|
r0 = rf(ctx, in, opts...)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*emptypb.Empty)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *v0.RemoveRoleFromUserRequest, ...client.CallOption) error); ok {
|
|
r1 = rf(ctx, in, opts...)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// RoleService_RemoveRoleFromUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveRoleFromUser'
|
|
type RoleService_RemoveRoleFromUser_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// RemoveRoleFromUser is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - in *v0.RemoveRoleFromUserRequest
|
|
// - opts ...client.CallOption
|
|
func (_e *RoleService_Expecter) RemoveRoleFromUser(ctx interface{}, in interface{}, opts ...interface{}) *RoleService_RemoveRoleFromUser_Call {
|
|
return &RoleService_RemoveRoleFromUser_Call{Call: _e.mock.On("RemoveRoleFromUser",
|
|
append([]interface{}{ctx, in}, opts...)...)}
|
|
}
|
|
|
|
func (_c *RoleService_RemoveRoleFromUser_Call) Run(run func(ctx context.Context, in *v0.RemoveRoleFromUserRequest, opts ...client.CallOption)) *RoleService_RemoveRoleFromUser_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
variadicArgs := make([]client.CallOption, len(args)-2)
|
|
for i, a := range args[2:] {
|
|
if a != nil {
|
|
variadicArgs[i] = a.(client.CallOption)
|
|
}
|
|
}
|
|
run(args[0].(context.Context), args[1].(*v0.RemoveRoleFromUserRequest), variadicArgs...)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *RoleService_RemoveRoleFromUser_Call) Return(_a0 *emptypb.Empty, _a1 error) *RoleService_RemoveRoleFromUser_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *RoleService_RemoveRoleFromUser_Call) RunAndReturn(run func(context.Context, *v0.RemoveRoleFromUserRequest, ...client.CallOption) (*emptypb.Empty, error)) *RoleService_RemoveRoleFromUser_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// NewRoleService creates a new instance of RoleService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
|
// The first argument is typically a *testing.T value.
|
|
func NewRoleService(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *RoleService {
|
|
mock := &RoleService{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|