[MM-32406] Introduce trace logging level for LDAP messages (#25118)

Этот коммит содержится в:
Ben Schumacher
2023-11-03 08:06:16 +01:00
коммит произвёл GitHub
родитель ce3b54d23e
Коммит e8569c91af
12 изменённых файлов: 82 добавлений и 79 удалений

Просмотреть файл

@@ -5,6 +5,7 @@ package einterfaces
import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/request"
)
type CloudInterface interface {
@@ -39,7 +40,7 @@ type CloudInterface interface {
ConfirmSelfHostedSignup(req model.SelfHostedConfirmPaymentMethodRequest, requesterEmail string) (*model.SelfHostedSignupConfirmResponse, error)
ConfirmSelfHostedExpansion(req model.SelfHostedConfirmPaymentMethodRequest, requesterEmail string) (*model.SelfHostedSignupConfirmResponse, error)
ConfirmSelfHostedSignupLicenseApplication() error
GetSelfHostedInvoices() ([]*model.Invoice, error)
GetSelfHostedInvoices(rctx request.CTX) ([]*model.Invoice, error)
GetSelfHostedInvoicePDF(invoiceID string) ([]byte, string, error)
CreateOrUpdateSubscriptionHistoryEvent(userID string, userCount int) (*model.SubscriptionHistory, error)

Просмотреть файл

@@ -11,20 +11,20 @@ import (
type LdapInterface interface {
DoLogin(c request.CTX, id string, password string) (*model.User, *model.AppError)
GetUser(c request.CTX, id string) (*model.User, *model.AppError)
GetUserAttributes(id string, attributes []string) (map[string]string, *model.AppError)
GetUserAttributes(rctx request.CTX, id string, attributes []string) (map[string]string, *model.AppError)
CheckPassword(c request.CTX, id string, password string) *model.AppError
CheckPasswordAuthData(c request.CTX, authData string, password string) *model.AppError
CheckProviderAttributes(c request.CTX, LS *model.LdapSettings, ouser *model.User, patch *model.UserPatch) string
SwitchToLdap(c request.CTX, userID, ldapID, ldapPassword string) *model.AppError
StartSynchronizeJob(c request.CTX, waitForJobToFinish bool, includeRemovedMembers bool) (*model.Job, *model.AppError)
RunTest() *model.AppError
RunTest(rctx request.CTX) *model.AppError
GetAllLdapUsers(c request.CTX) ([]*model.User, *model.AppError)
MigrateIDAttribute(c request.CTX, toAttribute string) error
GetGroup(groupUID string) (*model.Group, *model.AppError)
GetAllGroupsPage(page int, perPage int, opts model.LdapGroupSearchOpts) ([]*model.Group, int, *model.AppError)
GetGroup(rctx request.CTX, groupUID string) (*model.Group, *model.AppError)
GetAllGroupsPage(rctx request.CTX, page int, perPage int, opts model.LdapGroupSearchOpts) ([]*model.Group, int, *model.AppError)
FirstLoginSync(c request.CTX, user *model.User, userAuthService, userAuthData, email string) *model.AppError
UpdateProfilePictureIfNecessary(request.CTX, model.User, model.Session)
GetADLdapIdFromSAMLId(c request.CTX, authData string) string
GetSAMLIdFromADLdapId(c request.CTX, authData string) string
GetVendorNameAndVendorVersion() (string, string)
GetVendorNameAndVendorVersion(rctx request.CTX) (string, string)
}

Просмотреть файл

@@ -6,6 +6,7 @@ package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
request "github.com/mattermost/mattermost/server/public/shared/request"
mock "github.com/stretchr/testify/mock"
)
@@ -460,25 +461,25 @@ func (_m *CloudInterface) GetSelfHostedInvoicePDF(invoiceID string) ([]byte, str
return r0, r1, r2
}
// GetSelfHostedInvoices provides a mock function with given fields:
func (_m *CloudInterface) GetSelfHostedInvoices() ([]*model.Invoice, error) {
ret := _m.Called()
// GetSelfHostedInvoices provides a mock function with given fields: rctx
func (_m *CloudInterface) GetSelfHostedInvoices(rctx request.CTX) ([]*model.Invoice, error) {
ret := _m.Called(rctx)
var r0 []*model.Invoice
var r1 error
if rf, ok := ret.Get(0).(func() ([]*model.Invoice, error)); ok {
return rf()
if rf, ok := ret.Get(0).(func(request.CTX) ([]*model.Invoice, error)); ok {
return rf(rctx)
}
if rf, ok := ret.Get(0).(func() []*model.Invoice); ok {
r0 = rf()
if rf, ok := ret.Get(0).(func(request.CTX) []*model.Invoice); ok {
r0 = rf(rctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Invoice)
}
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
if rf, ok := ret.Get(1).(func(request.CTX) error); ok {
r1 = rf(rctx)
} else {
r1 = ret.Error(1)
}

Просмотреть файл

@@ -119,32 +119,32 @@ func (_m *LdapInterface) GetADLdapIdFromSAMLId(c request.CTX, authData string) s
return r0
}
// GetAllGroupsPage provides a mock function with given fields: page, perPage, opts
func (_m *LdapInterface) GetAllGroupsPage(page int, perPage int, opts model.LdapGroupSearchOpts) ([]*model.Group, int, *model.AppError) {
ret := _m.Called(page, perPage, opts)
// GetAllGroupsPage provides a mock function with given fields: rctx, page, perPage, opts
func (_m *LdapInterface) GetAllGroupsPage(rctx request.CTX, page int, perPage int, opts model.LdapGroupSearchOpts) ([]*model.Group, int, *model.AppError) {
ret := _m.Called(rctx, page, perPage, opts)
var r0 []*model.Group
var r1 int
var r2 *model.AppError
if rf, ok := ret.Get(0).(func(int, int, model.LdapGroupSearchOpts) ([]*model.Group, int, *model.AppError)); ok {
return rf(page, perPage, opts)
if rf, ok := ret.Get(0).(func(request.CTX, int, int, model.LdapGroupSearchOpts) ([]*model.Group, int, *model.AppError)); ok {
return rf(rctx, page, perPage, opts)
}
if rf, ok := ret.Get(0).(func(int, int, model.LdapGroupSearchOpts) []*model.Group); ok {
r0 = rf(page, perPage, opts)
if rf, ok := ret.Get(0).(func(request.CTX, int, int, model.LdapGroupSearchOpts) []*model.Group); ok {
r0 = rf(rctx, page, perPage, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Group)
}
}
if rf, ok := ret.Get(1).(func(int, int, model.LdapGroupSearchOpts) int); ok {
r1 = rf(page, perPage, opts)
if rf, ok := ret.Get(1).(func(request.CTX, int, int, model.LdapGroupSearchOpts) int); ok {
r1 = rf(rctx, page, perPage, opts)
} else {
r1 = ret.Get(1).(int)
}
if rf, ok := ret.Get(2).(func(int, int, model.LdapGroupSearchOpts) *model.AppError); ok {
r2 = rf(page, perPage, opts)
if rf, ok := ret.Get(2).(func(request.CTX, int, int, model.LdapGroupSearchOpts) *model.AppError); ok {
r2 = rf(rctx, page, perPage, opts)
} else {
if ret.Get(2) != nil {
r2 = ret.Get(2).(*model.AppError)
@@ -182,25 +182,25 @@ func (_m *LdapInterface) GetAllLdapUsers(c request.CTX) ([]*model.User, *model.A
return r0, r1
}
// GetGroup provides a mock function with given fields: groupUID
func (_m *LdapInterface) GetGroup(groupUID string) (*model.Group, *model.AppError) {
ret := _m.Called(groupUID)
// GetGroup provides a mock function with given fields: rctx, groupUID
func (_m *LdapInterface) GetGroup(rctx request.CTX, groupUID string) (*model.Group, *model.AppError) {
ret := _m.Called(rctx, groupUID)
var r0 *model.Group
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string) (*model.Group, *model.AppError)); ok {
return rf(groupUID)
if rf, ok := ret.Get(0).(func(request.CTX, string) (*model.Group, *model.AppError)); ok {
return rf(rctx, groupUID)
}
if rf, ok := ret.Get(0).(func(string) *model.Group); ok {
r0 = rf(groupUID)
if rf, ok := ret.Get(0).(func(request.CTX, string) *model.Group); ok {
r0 = rf(rctx, groupUID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Group)
}
}
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
r1 = rf(groupUID)
if rf, ok := ret.Get(1).(func(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, groupUID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
@@ -252,25 +252,25 @@ func (_m *LdapInterface) GetUser(c request.CTX, id string) (*model.User, *model.
return r0, r1
}
// GetUserAttributes provides a mock function with given fields: id, attributes
func (_m *LdapInterface) GetUserAttributes(id string, attributes []string) (map[string]string, *model.AppError) {
ret := _m.Called(id, attributes)
// GetUserAttributes provides a mock function with given fields: rctx, id, attributes
func (_m *LdapInterface) GetUserAttributes(rctx request.CTX, id string, attributes []string) (map[string]string, *model.AppError) {
ret := _m.Called(rctx, id, attributes)
var r0 map[string]string
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, []string) (map[string]string, *model.AppError)); ok {
return rf(id, attributes)
if rf, ok := ret.Get(0).(func(request.CTX, string, []string) (map[string]string, *model.AppError)); ok {
return rf(rctx, id, attributes)
}
if rf, ok := ret.Get(0).(func(string, []string) map[string]string); ok {
r0 = rf(id, attributes)
if rf, ok := ret.Get(0).(func(request.CTX, string, []string) map[string]string); ok {
r0 = rf(rctx, id, attributes)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[string]string)
}
}
if rf, ok := ret.Get(1).(func(string, []string) *model.AppError); ok {
r1 = rf(id, attributes)
if rf, ok := ret.Get(1).(func(request.CTX, string, []string) *model.AppError); ok {
r1 = rf(rctx, id, attributes)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
@@ -280,23 +280,23 @@ func (_m *LdapInterface) GetUserAttributes(id string, attributes []string) (map[
return r0, r1
}
// GetVendorNameAndVendorVersion provides a mock function with given fields:
func (_m *LdapInterface) GetVendorNameAndVendorVersion() (string, string) {
ret := _m.Called()
// GetVendorNameAndVendorVersion provides a mock function with given fields: rctx
func (_m *LdapInterface) GetVendorNameAndVendorVersion(rctx request.CTX) (string, string) {
ret := _m.Called(rctx)
var r0 string
var r1 string
if rf, ok := ret.Get(0).(func() (string, string)); ok {
return rf()
if rf, ok := ret.Get(0).(func(request.CTX) (string, string)); ok {
return rf(rctx)
}
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
if rf, ok := ret.Get(0).(func(request.CTX) string); ok {
r0 = rf(rctx)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func() string); ok {
r1 = rf()
if rf, ok := ret.Get(1).(func(request.CTX) string); ok {
r1 = rf(rctx)
} else {
r1 = ret.Get(1).(string)
}
@@ -318,13 +318,13 @@ func (_m *LdapInterface) MigrateIDAttribute(c request.CTX, toAttribute string) e
return r0
}
// RunTest provides a mock function with given fields:
func (_m *LdapInterface) RunTest() *model.AppError {
ret := _m.Called()
// RunTest provides a mock function with given fields: rctx
func (_m *LdapInterface) RunTest(rctx request.CTX) *model.AppError {
ret := _m.Called(rctx)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func() *model.AppError); ok {
r0 = rf()
if rf, ok := ret.Get(0).(func(request.CTX) *model.AppError); ok {
r0 = rf(rctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)