snapshot of https://github.com/mattermost/mattermost.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 2s
Server CI Nightly Race / Build Environment (push) Failing after 1s

This commit is contained in:
upstream-mirror
2026-09-16 00:29:55 +05:00
commit 240db4e2a7
15309 changed files with 2173406 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
with-expecter: false
packages:
github.com/mattermost/mattermost/server/v8/einterfaces:
config:
all: true
dir: "einterfaces/mocks"
filename: "{{.InterfaceName}}.go"
mockname: "{{.InterfaceName}}"
outpkg: mocks
recursive: true
exclude:
- mocks
note: "Regenerate this file using `make einterfaces-mocks`."

View File

@@ -0,0 +1,12 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
// AccessControlServiceInterface is the interface that provides access control
// services. It combines the PolicyAdministrationPointInterface and
// PolicyDecisionPointInterface interfaces to provide a complete access control solution.
type AccessControlServiceInterface interface {
PolicyAdministrationPointInterface
PolicyDecisionPointInterface
}

View File

@@ -0,0 +1,14 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/request"
)
type AccountMigrationInterface interface {
MigrateToLdap(rctx request.CTX, fromAuthService string, foreignUserFieldNameToMatch string, force bool, dryRun bool) *model.AppError
MigrateToSaml(rctx request.CTX, fromAuthService string, usersMap map[string]string, auto bool, dryRun bool) *model.AppError
}

View File

@@ -0,0 +1,79 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"context"
"github.com/mattermost/mattermost/server/public/model"
ejobs "github.com/mattermost/mattermost/server/v8/einterfaces/jobs"
)
// AutoTranslationInterface defines the enterprise advanced auto-translation functionality.
// This interface provides methods for managing channel and user translation settings,
// and performing translations on content.
type AutoTranslationInterface interface {
// IsFeatureAvailable checks if the auto-translation feature is available.
// Returns true if license, feature flag, and config all allow auto-translation.
// Callers should check this before calling other methods to handle unavailability gracefully.
IsFeatureAvailable() bool
// IsChannelEnabled checks if auto-translation is enabled for a channel.
// Returns false if the feature is unavailable (license, config, etc.).
IsChannelEnabled(channelID string) (bool, *model.AppError)
// IsUserEnabled checks if auto-translation is enabled for a specific user in a channel.
// This checks both channel enablement AND user opt-in status.
// Returns false if the feature is unavailable or the user hasn't opted in.
IsUserEnabled(channelID, userID string) (bool, *model.AppError)
// Translate translates content in a channel.
//
// Parameters:
// - ctx: context for cancellation, deadlines, and request-scoped values (e.g., translation path for metrics)
// - objectType: type of content being translated (e.g., "post", "playbook_run")
// - objectID: unique identifier for the object
// - channelID: channel containing the object
// - userID: user requesting the translation
// - content: the content to translate (string, json.RawMessage, map[string]any or *model.Post)
//
// Returns:
// - Translation object, nil error: Translation available or being created for the requesting user
// - nil, nil: User has not opted in to auto-translation (not an error - user choice)
// - nil, error: Feature unavailable, validation failed, DB error, or no translatable content
//
// Note: Translations are still initialized for other users even when returning nil, nil for a non-opted-in user.
Translate(ctx context.Context, objectType, objectID, channelID, userID string, content any) (*model.Translation, *model.AppError)
// GetBatch fetches a batch of translations for a list of object IDs and a destination language.
// This is used for efficiently populating translations for list views (e.g., channel history).
// Returns error if the feature is unavailable.
GetBatch(objectType string, objectIDs []string, dstLang string) (map[string]*model.Translation, *model.AppError)
// GetUserLanguage returns the preferred language for a user in a channel if auto-translation is enabled.
// Returns the language code or error if feature is unavailable.
GetUserLanguage(userID, channelID string) (string, *model.AppError)
// DetectRemote detects the language of the provided content using the remote provider.
// Returns error if the feature is unavailable.
DetectRemote(ctx context.Context, text string) (string, *float64, *model.AppError)
// Close cleans up resources used by the auto-translation implementation.
// This includes removing the config listener and shutting down the provider if present.
Close() error
// Start initializes and starts the auto-translation service, including workers.
Start() error
// Shutdown gracefully shuts down the auto-translation service.
Shutdown() error
// MakeWorker creates a worker for the autotranslation recovery sweep job.
// The worker picks up stuck translations and re-queues them for processing.
MakeWorker() model.Worker
// MakeScheduler creates a scheduler for the autotranslation recovery sweep job.
// The scheduler runs periodically to detect stuck translations.
MakeScheduler() ejobs.Scheduler
}

View File

@@ -0,0 +1,43 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"mime/multipart"
"github.com/mattermost/mattermost/server/public/model"
)
type CloudInterface interface {
GetCloudProduct(userID string, productID string) (*model.Product, error)
GetCloudProducts(userID string, includeLegacyProducts bool) ([]*model.Product, error)
GetSelfHostedProducts(userID string) ([]*model.Product, error)
GetCloudLimits(userID string) (*model.ProductLimits, error)
GetCloudCustomer(userID string) (*model.CloudCustomer, error)
UpdateCloudCustomer(userID string, customerInfo *model.CloudCustomerInfo) (*model.CloudCustomer, error)
UpdateCloudCustomerAddress(userID string, address *model.Address) (*model.CloudCustomer, error)
GetSubscription(userID string) (*model.Subscription, error)
GetInvoicesForSubscription(userID string) ([]*model.Invoice, error)
GetInvoicePDF(userID, invoiceID string) ([]byte, string, error)
ChangeSubscription(userID, subscriptionID string, subscriptionChange *model.SubscriptionChange) (*model.Subscription, error)
ValidateBusinessEmail(userID, email string) error
InvalidateCaches() error
CreateOrUpdateSubscriptionHistoryEvent(userID string, userCount int) (*model.SubscriptionHistory, error)
HandleLicenseChange() error
CheckCWSConnection(userId string) error
ApplyIPFilters(userID string, ranges *model.AllowedIPRanges) (*model.AllowedIPRanges, error)
GetIPFilters(userID string) (*model.AllowedIPRanges, error)
GetInstallation(userID string) (*model.Installation, error)
RemoveAuditLoggingCert(userID string) error
CreateAuditLoggingCert(userID string, fileData *multipart.FileHeader) error
}

View File

@@ -0,0 +1,41 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/request"
)
type ClusterMessageHandler func(msg *model.ClusterMessage)
type ClusterInterface interface {
StartInterNodeCommunication()
StopInterNodeCommunication()
RegisterClusterMessageHandler(event model.ClusterEvent, crm ClusterMessageHandler)
GetClusterId() string
IsLeader() bool
// HealthScore returns a number which is indicative of how well an instance is meeting
// the soft real-time requirements of the protocol. Lower numbers are better,
// and zero means "totally healthy".
HealthScore() int
GetMyClusterInfo() *model.ClusterInfo
GetClusterInfos() ([]*model.ClusterInfo, error)
SendClusterMessage(msg *model.ClusterMessage)
SendClusterMessageToNode(nodeID string, msg *model.ClusterMessage) error
Shutdown()
NotifyMsg(buf []byte)
GetClusterStats(rctx request.CTX) ([]*model.ClusterStats, *model.AppError)
GetLogs(rctx request.CTX, page, perPage int) ([]string, *model.AppError)
QueryLogs(rctx request.CTX, page, perPage int) (map[string][]string, *model.AppError)
GenerateSupportPacket(rctx request.CTX, options *model.SupportPacketOptions) (map[string][]model.FileData, error)
GetPluginStatuses() (model.PluginStatuses, *model.AppError)
ConfigChanged(previousConfig *model.Config, newConfig *model.Config, sendToOtherServer bool) *model.AppError
// WebConnCountForUser returns the number of active webconn connections
// for a given userID.
WebConnCountForUser(userID string) (int, *model.AppError)
// GetWSQueues returns the necessary websocket queues from a cluster for a given
// connectionID and sequence number.
GetWSQueues(userID, connectionID string, seqNum int64) (map[string]*model.WSQueues, error)
}

View File

@@ -0,0 +1,14 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/request"
)
type ComplianceInterface interface {
StartComplianceDailyJob()
RunComplianceJob(rctx request.CTX, job *model.Compliance) *model.AppError
}

View File

@@ -0,0 +1,26 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost/server/public/model"
)
type DataRetentionInterface interface {
GetGlobalPolicy() (*model.GlobalRetentionPolicy, *model.AppError)
GetPolicies(offset, limit int) (*model.RetentionPolicyWithTeamAndChannelCountsList, *model.AppError)
GetPoliciesCount() (int64, *model.AppError)
GetPolicy(policyID string) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError)
CreatePolicy(policy *model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError)
PatchPolicy(patch *model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError)
DeletePolicy(policyID string) *model.AppError
GetTeamsForPolicy(policyID string, offset, limit int) (*model.TeamsWithCount, *model.AppError)
AddTeamsToPolicy(policyID string, teamIDs []string) *model.AppError
RemoveTeamsFromPolicy(policyID string, teamIDs []string) *model.AppError
GetChannelsForPolicy(policyID string, offset, limit int) (*model.ChannelsWithCount, *model.AppError)
AddChannelsToPolicy(policyID string, channelIDs []string) *model.AppError
RemoveChannelsFromPolicy(policyID string, channelIDs []string) *model.AppError
GetTeamPoliciesForUser(userID string, offset, limit int) (*model.RetentionPolicyForTeamList, *model.AppError)
GetChannelPoliciesForUser(userID string, offset, limit int) (*model.RetentionPolicyForChannelList, *model.AppError)
}

View File

@@ -0,0 +1,34 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/request"
)
// IntuneInterface provides methods for Microsoft Intune MAM authentication.
// This allows mobile users to authenticate via Microsoft Entra ID (Azure AD) MSAL tokens
// and map to existing users who login via Office 365 or SAML on other clients.
type IntuneInterface interface {
// IsConfigured checks if Intune MAM is properly configured and enabled.
// Returns true if IntuneSettings.Enable is true and all required configuration is present.
IsConfigured() bool
// Login authenticates a user using a Microsoft Entra ID access_token from MSAL.
// The token is validated against Microsoft's JWKS endpoint with proper key rollover support.
// The access_token's audience claim is validated against the tenant-specific IntuneScope
// to ensure proper tenant isolation.
// The user is then matched to an existing user based on the configured AuthService
// (either 'office365' or 'saml'), or a new user is created if allowed.
//
// Parameters:
// - rctx: Request context for logging and tracing
// - accessToken: The access_token from MSAL authentication
//
// Returns:
// - user: The authenticated user (matched or newly created)
// - appError: Error if authentication fails
Login(rctx request.CTX, accessToken string) (*model.User, *model.AppError)
}

View File

@@ -0,0 +1,11 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import "github.com/mattermost/mattermost/server/public/model"
type IPFilteringInterface interface {
ApplyIPFilters(allowedIPRanges *model.AllowedIPRanges) (*model.AllowedIPRanges, error)
GetIPFilters() (*model.AllowedIPRanges, error)
}

View File

@@ -0,0 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package jobs
import (
"github.com/mattermost/mattermost/server/public/model"
)
type AccessControlSyncJobInterface interface {
MakeWorker() model.Worker
MakeScheduler() Scheduler
}

View File

@@ -0,0 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package jobs
import (
"github.com/mattermost/mattermost/server/public/model"
)
type CloudJobInterface interface {
MakeWorker() model.Worker
MakeScheduler() Scheduler
}

View File

@@ -0,0 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package jobs
import (
"github.com/mattermost/mattermost/server/public/model"
)
type DataRetentionJobInterface interface {
MakeWorker() model.Worker
MakeScheduler() Scheduler
}

View File

@@ -0,0 +1,17 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package jobs
import (
"github.com/mattermost/mattermost/server/public/model"
)
type ElasticsearchIndexerInterface interface {
MakeWorker() model.Worker
}
type ElasticsearchAggregatorInterface interface {
MakeWorker() model.Worker
MakeScheduler() Scheduler
}

View File

@@ -0,0 +1,12 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package jobs
import (
"github.com/mattermost/mattermost/server/public/model"
)
type IndexerJobInterface interface {
MakeWorker() model.Worker
}

View File

@@ -0,0 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package jobs
import (
"github.com/mattermost/mattermost/server/public/model"
)
type LdapSyncInterface interface {
MakeWorker() model.Worker
MakeScheduler() Scheduler
}

View File

@@ -0,0 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package jobs
import (
"github.com/mattermost/mattermost/server/public/model"
)
type MessageExportJobInterface interface {
MakeWorker() model.Worker
MakeScheduler() Scheduler
}

View File

@@ -0,0 +1,17 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package jobs
import (
"time"
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/request"
)
type Scheduler interface {
Enabled(cfg *model.Config) bool
NextScheduleTime(cfg *model.Config, now time.Time, pendingJobs bool, lastSuccessfulJob *model.Job) *time.Time
ScheduleJob(rctx request.CTX, cfg *model.Config, pendingJobs bool, lastSuccessfulJob *model.Job) (*model.Job, *model.AppError)
}

View File

@@ -0,0 +1,32 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/request"
)
type LdapInterface interface {
DoLogin(rctx request.CTX, id string, password string) (*model.User, *model.AppError)
GetUser(rctx request.CTX, id string) (*model.User, *model.AppError)
GetLDAPUserForMMUser(rctx request.CTX, mmUser *model.User) (*model.User, string, *model.AppError)
GetUserAttributes(rctx request.CTX, id string, attributes []string) (map[string]string, *model.AppError)
CheckProviderAttributes(rctx request.CTX, LS *model.LdapSettings, ouser *model.User, patch *model.UserPatch) string
SwitchToLdap(rctx request.CTX, userID, ldapID, ldapPassword string) *model.AppError
StartSynchronizeJob(rctx request.CTX, waitForJobToFinish bool) (*model.Job, *model.AppError)
GetAllLdapUsers(rctx request.CTX) ([]*model.User, *model.AppError)
MigrateIDAttribute(rctx request.CTX, toAttribute string) error
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(rctx request.CTX, user *model.User) *model.AppError
UpdateProfilePictureIfNecessary(request.CTX, model.User, model.Session)
}
type LdapDiagnosticInterface interface {
RunTest(rctx request.CTX) *model.AppError
GetVendorNameAndVendorVersion(rctx request.CTX) (string, string, error)
RunTestConnection(rctx request.CTX, settings model.LdapSettings) *model.AppError
RunTestDiagnostics(rctx request.CTX, testType model.LdapDiagnosticTestType, settings model.LdapSettings) ([]model.LdapDiagnosticResult, *model.AppError)
}

View File

@@ -0,0 +1,12 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import "github.com/mattermost/mattermost/server/public/model"
type LicenseInterface interface {
CanStartTrial() (bool, error)
GetPrevTrial() (*model.License, error)
NewMattermostEntryLicense(serverId string) *model.License
}

View File

@@ -0,0 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/request"
)
type MessageExportInterface interface {
StartSynchronizeJob(rctx request.CTX, exportFromTimestamp int64) (*model.Job, *model.AppError)
}

View File

@@ -0,0 +1,153 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"database/sql"
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)
type MetricsInterface interface {
Register()
RegisterDBCollector(db *sql.DB, name string)
UnregisterDBCollector(db *sql.DB, name string)
IncrementPostCreate()
IncrementWebhookPost()
IncrementPostSentEmail()
IncrementPostSentPush()
IncrementPostBroadcast()
IncrementPostFileAttachment(count int)
IncrementHTTPRequest()
IncrementHTTPError()
IncrementClusterRequest()
ObserveClusterRequestDuration(elapsed float64)
IncrementClusterEventType(eventType model.ClusterEvent)
ObserveClusterReliableFallbackLength(event model.ClusterEvent, length int)
IncrementLogin()
IncrementLoginFail()
IncrementEtagHitCounter(route string)
IncrementEtagMissCounter(route string)
IncrementMemCacheHitCounter(cacheName string)
IncrementMemCacheMissCounter(cacheName string)
IncrementMemCacheInvalidationCounter(cacheName string)
IncrementMemCacheMissCounterSession()
IncrementMemCacheHitCounterSession()
IncrementMemCacheInvalidationCounterSession()
IncrementWebsocketEvent(eventType model.WebsocketEventType)
IncrementWebSocketBroadcast(eventType model.WebsocketEventType)
IncrementWebSocketBroadcastBufferSize(hub string, amount float64)
DecrementWebSocketBroadcastBufferSize(hub string, amount float64)
IncrementWebSocketBroadcastUsersRegistered(hub string, amount float64)
DecrementWebSocketBroadcastUsersRegistered(hub string, amount float64)
IncrementWebsocketReconnectEventWithDisconnectErrCode(eventType string, disconnectErrCode string)
IncrementHTTPWebSockets(originClient string)
DecrementHTTPWebSockets(originClient string)
AddMemCacheHitCounter(cacheName string, amount float64)
AddMemCacheMissCounter(cacheName string, amount float64)
IncrementPostsSearchCounter()
ObservePostsSearchDuration(elapsed float64)
IncrementFilesSearchCounter()
ObserveFilesSearchDuration(elapsed float64)
ObserveStoreMethodDuration(method, success string, elapsed float64)
ObserveAPIEndpointDuration(endpoint, method, statusCode, originClient, pageLoadContext string, elapsed float64)
ObserveRedisEndpointDuration(cacheName, operation string, elapsed float64)
IncrementPostIndexCounter()
IncrementFileIndexCounter()
IncrementUserIndexCounter()
IncrementChannelIndexCounter()
ObservePluginHookDuration(pluginID, hookName string, success bool, elapsed float64)
ObservePluginMultiHookIterationDuration(pluginID string, elapsed float64)
ObservePluginMultiHookDuration(elapsed float64)
ObservePluginAPIDuration(pluginID, apiName string, success bool, elapsed float64)
ObserveEnabledUsers(users int64)
GetLoggerMetricsCollector() mlog.MetricsCollector
IncrementRemoteClusterMsgSentCounter(remoteID string)
IncrementRemoteClusterMsgReceivedCounter(remoteID string)
IncrementRemoteClusterMsgErrorsCounter(remoteID string, timeout bool)
ObserveRemoteClusterPingDuration(remoteID string, elapsed float64)
ObserveRemoteClusterClockSkew(remoteID string, skew float64)
IncrementRemoteClusterConnStateChangeCounter(remoteID string, online bool)
IncrementSharedChannelsSyncCounter(remoteID string)
ObserveSharedChannelsTaskInQueueDuration(elapsed float64)
ObserveSharedChannelsQueueSize(size int64)
ObserveSharedChannelsSyncCollectionDuration(remoteID string, elapsed float64)
ObserveSharedChannelsSyncSendDuration(remoteID string, elapsed float64)
ObserveSharedChannelsSyncCollectionStepDuration(remoteID string, step string, elapsed float64)
ObserveSharedChannelsSyncSendStepDuration(remoteID string, step string, elapsed float64)
IncrementJobActive(jobType string)
DecrementJobActive(jobType string)
SetReplicaLagAbsolute(node string, value float64)
SetReplicaLagTime(node string, value float64)
IncrementNotificationCounter(notificationType model.NotificationType, platform string)
IncrementNotificationAckCounter(notificationType model.NotificationType, platform string)
IncrementNotificationSuccessCounter(notificationType model.NotificationType, platform string)
IncrementNotificationErrorCounter(notificationType model.NotificationType, errorReason model.NotificationReason, platform string)
IncrementNotificationNotSentCounter(notificationType model.NotificationType, notSentReason model.NotificationReason, platform string)
IncrementNotificationUnsupportedCounter(notificationType model.NotificationType, notSentReason model.NotificationReason, platform string)
ObserveClientTimeToFirstByte(platform, agent, userID string, elapsed float64)
ObserveClientTimeToLastByte(platform, agent, userID string, elapsed float64)
ObserveClientTimeToDomInteractive(platform, agent, userID string, elapsed float64)
ObserveClientSplashScreenEnd(platform, agent, pageType, userID string, elapsed float64)
ObserveClientFirstContentfulPaint(platform, agent, userID string, elapsed float64)
ObserveClientLargestContentfulPaint(platform, agent, region, userID string, elapsed float64)
ObserveClientInteractionToNextPaint(platform, agent, interaction, userID string, elapsed float64)
ObserveClientCumulativeLayoutShift(platform, agent, userID string, elapsed float64)
IncrementClientLongTasks(platform, agent, userID string, inc float64)
ObserveClientPageLoadDuration(platform, agent, userID string, elapsed float64)
ObserveClientChannelSwitchDuration(platform, agent, fresh, userID string, elapsed float64)
ObserveClientTeamSwitchDuration(platform, agent, fresh, userID string, elapsed float64)
ObserveClientRHSLoadDuration(platform, agent, userID string, elapsed float64)
ObserveGlobalThreadsLoadDuration(platform, agent, userID string, elapsed float64)
ObserveMobileClientLoadDuration(platform string, elapsed float64)
ObserveMobileClientChannelSwitchDuration(platform string, elapsed float64)
ObserveMobileClientTeamSwitchDuration(platform string, elapsed float64)
ObserveMobileClientNetworkRequestsAverageSpeed(platform, agent, networkRequestGroup string, speed float64)
ObserveMobileClientNetworkRequestsEffectiveLatency(platform, agent, networkRequestGroup string, latency float64)
ObserveMobileClientNetworkRequestsElapsedTime(platform, agent, networkRequestGroup string, elapsedTime float64)
ObserveMobileClientNetworkRequestsLatency(platform, agent, networkRequestGroup string, latency float64)
ObserveMobileClientNetworkRequestsTotalCompressedSize(platform, agent, networkRequestGroup string, size float64)
ObserveMobileClientNetworkRequestsTotalParallelRequests(platform, agent, networkRequestGroup string, count float64)
ObserveMobileClientNetworkRequestsTotalRequests(platform, agent, networkRequestGroup string, count float64)
ObserveMobileClientNetworkRequestsTotalSequentialRequests(platform, agent, networkRequestGroup string, count float64)
ObserveMobileClientNetworkRequestsTotalSize(platform, agent, networkRequestGroup string, size float64)
ClearMobileClientSessionMetadata()
ObserveMobileClientSessionMetadata(version string, platform string, value float64, notificationDisabled string)
ObserveDesktopCpuUsage(platform, version, process string, usage float64)
ObserveDesktopMemoryUsage(platform, version, process string, usage float64)
ObservePluginWebappPerf(platform, agent, pluginID, pluginMetricLabel string, elapsed float64)
ObserveAccessControlSearchQueryDuration(value float64)
ObserveAccessControlExpressionCompileDuration(value float64)
ObserveAccessControlEvaluateDuration(value float64)
IncrementAccessControlCacheInvalidation()
// Auto-translation metrics
ObserveAutoTranslateTranslateDuration(objectType string, elapsed float64)
ObserveAutoTranslateLinguaDetectionDuration(elapsed float64)
ObserveAutoTranslateProviderCallDuration(provider, result string, elapsed float64)
SetAutoTranslateQueueDepth(depth float64)
ObserveAutoTranslateWorkerTaskDuration(elapsed float64)
AddAutoTranslateRecoveryStuckFound(count float64)
IncrementAutoTranslateNormHash(result string)
}

View File

@@ -0,0 +1,620 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
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"
)
// AccessControlServiceInterface is an autogenerated mock type for the AccessControlServiceInterface type
type AccessControlServiceInterface struct {
mock.Mock
}
// AccessEvaluation provides a mock function with given fields: rctx, accessRequest
func (_m *AccessControlServiceInterface) AccessEvaluation(rctx request.CTX, accessRequest model.AccessRequest) (model.AccessDecision, *model.AppError) {
ret := _m.Called(rctx, accessRequest)
if len(ret) == 0 {
panic("no return value specified for AccessEvaluation")
}
var r0 model.AccessDecision
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, model.AccessRequest) (model.AccessDecision, *model.AppError)); ok {
return rf(rctx, accessRequest)
}
if rf, ok := ret.Get(0).(func(request.CTX, model.AccessRequest) model.AccessDecision); ok {
r0 = rf(rctx, accessRequest)
} else {
r0 = ret.Get(0).(model.AccessDecision)
}
if rf, ok := ret.Get(1).(func(request.CTX, model.AccessRequest) *model.AppError); ok {
r1 = rf(rctx, accessRequest)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// CheckExpression provides a mock function with given fields: rctx, expression
func (_m *AccessControlServiceInterface) CheckExpression(rctx request.CTX, expression string) ([]model.CELExpressionError, *model.AppError) {
ret := _m.Called(rctx, expression)
if len(ret) == 0 {
panic("no return value specified for CheckExpression")
}
var r0 []model.CELExpressionError
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) ([]model.CELExpressionError, *model.AppError)); ok {
return rf(rctx, expression)
}
if rf, ok := ret.Get(0).(func(request.CTX, string) []model.CELExpressionError); ok {
r0 = rf(rctx, expression)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]model.CELExpressionError)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, expression)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// DeletePolicy provides a mock function with given fields: rctx, id
func (_m *AccessControlServiceInterface) DeletePolicy(rctx request.CTX, id string) *model.AppError {
ret := _m.Called(rctx, id)
if len(ret) == 0 {
panic("no return value specified for DeletePolicy")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) *model.AppError); ok {
r0 = rf(rctx, id)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// ExpressionToVisualAST provides a mock function with given fields: rctx, expression
func (_m *AccessControlServiceInterface) ExpressionToVisualAST(rctx request.CTX, expression string) (*model.VisualExpression, *model.AppError) {
ret := _m.Called(rctx, expression)
if len(ret) == 0 {
panic("no return value specified for ExpressionToVisualAST")
}
var r0 *model.VisualExpression
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) (*model.VisualExpression, *model.AppError)); ok {
return rf(rctx, expression)
}
if rf, ok := ret.Get(0).(func(request.CTX, string) *model.VisualExpression); ok {
r0 = rf(rctx, expression)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.VisualExpression)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, expression)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetChannelMembersToRemove provides a mock function with given fields: rctx, channelID
func (_m *AccessControlServiceInterface) GetChannelMembersToRemove(rctx request.CTX, channelID string) ([]*model.ChannelMember, *model.AppError) {
ret := _m.Called(rctx, channelID)
if len(ret) == 0 {
panic("no return value specified for GetChannelMembersToRemove")
}
var r0 []*model.ChannelMember
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) ([]*model.ChannelMember, *model.AppError)); ok {
return rf(rctx, channelID)
}
if rf, ok := ret.Get(0).(func(request.CTX, string) []*model.ChannelMember); ok {
r0 = rf(rctx, channelID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.ChannelMember)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, channelID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetPoliciesForFieldIDs provides a mock function with given fields: rctx, fieldIDs
func (_m *AccessControlServiceInterface) GetPoliciesForFieldIDs(rctx request.CTX, fieldIDs []string) ([]*model.AccessControlPolicy, *model.AppError) {
ret := _m.Called(rctx, fieldIDs)
if len(ret) == 0 {
panic("no return value specified for GetPoliciesForFieldIDs")
}
var r0 []*model.AccessControlPolicy
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, []string) ([]*model.AccessControlPolicy, *model.AppError)); ok {
return rf(rctx, fieldIDs)
}
if rf, ok := ret.Get(0).(func(request.CTX, []string) []*model.AccessControlPolicy); ok {
r0 = rf(rctx, fieldIDs)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.AccessControlPolicy)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, []string) *model.AppError); ok {
r1 = rf(rctx, fieldIDs)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetPolicy provides a mock function with given fields: rctx, id
func (_m *AccessControlServiceInterface) GetPolicy(rctx request.CTX, id string) (*model.AccessControlPolicy, *model.AppError) {
ret := _m.Called(rctx, id)
if len(ret) == 0 {
panic("no return value specified for GetPolicy")
}
var r0 *model.AccessControlPolicy
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) (*model.AccessControlPolicy, *model.AppError)); ok {
return rf(rctx, id)
}
if rf, ok := ret.Get(0).(func(request.CTX, string) *model.AccessControlPolicy); ok {
r0 = rf(rctx, id)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AccessControlPolicy)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, id)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetPolicyRuleAttributes provides a mock function with given fields: rctx, policyID, action
func (_m *AccessControlServiceInterface) GetPolicyRuleAttributes(rctx request.CTX, policyID string, action string) (map[string][]string, *model.AppError) {
ret := _m.Called(rctx, policyID, action)
if len(ret) == 0 {
panic("no return value specified for GetPolicyRuleAttributes")
}
var r0 map[string][]string
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, string) (map[string][]string, *model.AppError)); ok {
return rf(rctx, policyID, action)
}
if rf, ok := ret.Get(0).(func(request.CTX, string, string) map[string][]string); ok {
r0 = rf(rctx, policyID, action)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[string][]string)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string, string) *model.AppError); ok {
r1 = rf(rctx, policyID, action)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetTeamMembersToRemove provides a mock function with given fields: rctx, teamID
func (_m *AccessControlServiceInterface) GetTeamMembersToRemove(rctx request.CTX, teamID string) ([]*model.TeamMember, *model.AppError) {
ret := _m.Called(rctx, teamID)
if len(ret) == 0 {
panic("no return value specified for GetTeamMembersToRemove")
}
var r0 []*model.TeamMember
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) ([]*model.TeamMember, *model.AppError)); ok {
return rf(rctx, teamID)
}
if rf, ok := ret.Get(0).(func(request.CTX, string) []*model.TeamMember); ok {
r0 = rf(rctx, teamID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.TeamMember)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, teamID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// HasMaskedValuesForCaller provides a mock function with given fields: rctx, expression, resolver
func (_m *AccessControlServiceInterface) HasMaskedValuesForCaller(rctx request.CTX, expression string, resolver model.MaskingFieldResolver) (bool, *model.AppError) {
ret := _m.Called(rctx, expression, resolver)
if len(ret) == 0 {
panic("no return value specified for HasMaskedValuesForCaller")
}
var r0 bool
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, model.MaskingFieldResolver) (bool, *model.AppError)); ok {
return rf(rctx, expression, resolver)
}
if rf, ok := ret.Get(0).(func(request.CTX, string, model.MaskingFieldResolver) bool); ok {
r0 = rf(rctx, expression, resolver)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(request.CTX, string, model.MaskingFieldResolver) *model.AppError); ok {
r1 = rf(rctx, expression, resolver)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// Init provides a mock function with given fields: rctx
func (_m *AccessControlServiceInterface) Init(rctx request.CTX) *model.AppError {
ret := _m.Called(rctx)
if len(ret) == 0 {
panic("no return value specified for Init")
}
var r0 *model.AppError
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)
}
}
return r0
}
// MaskExpressionForCaller provides a mock function with given fields: rctx, expression, resolver
func (_m *AccessControlServiceInterface) MaskExpressionForCaller(rctx request.CTX, expression string, resolver model.MaskingFieldResolver) (string, bool, *model.AppError) {
ret := _m.Called(rctx, expression, resolver)
if len(ret) == 0 {
panic("no return value specified for MaskExpressionForCaller")
}
var r0 string
var r1 bool
var r2 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, model.MaskingFieldResolver) (string, bool, *model.AppError)); ok {
return rf(rctx, expression, resolver)
}
if rf, ok := ret.Get(0).(func(request.CTX, string, model.MaskingFieldResolver) string); ok {
r0 = rf(rctx, expression, resolver)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(request.CTX, string, model.MaskingFieldResolver) bool); ok {
r1 = rf(rctx, expression, resolver)
} else {
r1 = ret.Get(1).(bool)
}
if rf, ok := ret.Get(2).(func(request.CTX, string, model.MaskingFieldResolver) *model.AppError); ok {
r2 = rf(rctx, expression, resolver)
} else {
if ret.Get(2) != nil {
r2 = ret.Get(2).(*model.AppError)
}
}
return r0, r1, r2
}
// MergeExpressionWithMaskedValuesCanonical provides a mock function with given fields: rctx, submittedExpr, storedExpr, resolver
func (_m *AccessControlServiceInterface) MergeExpressionWithMaskedValuesCanonical(rctx request.CTX, submittedExpr string, storedExpr string, resolver model.MaskingFieldResolver) (string, *model.AppError) {
ret := _m.Called(rctx, submittedExpr, storedExpr, resolver)
if len(ret) == 0 {
panic("no return value specified for MergeExpressionWithMaskedValuesCanonical")
}
var r0 string
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, string, model.MaskingFieldResolver) (string, *model.AppError)); ok {
return rf(rctx, submittedExpr, storedExpr, resolver)
}
if rf, ok := ret.Get(0).(func(request.CTX, string, string, model.MaskingFieldResolver) string); ok {
r0 = rf(rctx, submittedExpr, storedExpr, resolver)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(request.CTX, string, string, model.MaskingFieldResolver) *model.AppError); ok {
r1 = rf(rctx, submittedExpr, storedExpr, resolver)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// NormalizePolicy provides a mock function with given fields: rctx, policy
func (_m *AccessControlServiceInterface) NormalizePolicy(rctx request.CTX, policy *model.AccessControlPolicy) (*model.AccessControlPolicy, *model.AppError) {
ret := _m.Called(rctx, policy)
if len(ret) == 0 {
panic("no return value specified for NormalizePolicy")
}
var r0 *model.AccessControlPolicy
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, *model.AccessControlPolicy) (*model.AccessControlPolicy, *model.AppError)); ok {
return rf(rctx, policy)
}
if rf, ok := ret.Get(0).(func(request.CTX, *model.AccessControlPolicy) *model.AccessControlPolicy); ok {
r0 = rf(rctx, policy)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AccessControlPolicy)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, *model.AccessControlPolicy) *model.AppError); ok {
r1 = rf(rctx, policy)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// OnPropertyFieldOptionsChanged provides a mock function with given fields: rctx, fieldID
func (_m *AccessControlServiceInterface) OnPropertyFieldOptionsChanged(rctx request.CTX, fieldID string) {
_m.Called(rctx, fieldID)
}
// QueryUsersForExpression provides a mock function with given fields: rctx, expression, opts
func (_m *AccessControlServiceInterface) QueryUsersForExpression(rctx request.CTX, expression string, opts model.SubjectSearchOptions) ([]*model.User, int64, *model.AppError) {
ret := _m.Called(rctx, expression, opts)
if len(ret) == 0 {
panic("no return value specified for QueryUsersForExpression")
}
var r0 []*model.User
var r1 int64
var r2 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, model.SubjectSearchOptions) ([]*model.User, int64, *model.AppError)); ok {
return rf(rctx, expression, opts)
}
if rf, ok := ret.Get(0).(func(request.CTX, string, model.SubjectSearchOptions) []*model.User); ok {
r0 = rf(rctx, expression, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.User)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string, model.SubjectSearchOptions) int64); ok {
r1 = rf(rctx, expression, opts)
} else {
r1 = ret.Get(1).(int64)
}
if rf, ok := ret.Get(2).(func(request.CTX, string, model.SubjectSearchOptions) *model.AppError); ok {
r2 = rf(rctx, expression, opts)
} else {
if ret.Get(2) != nil {
r2 = ret.Get(2).(*model.AppError)
}
}
return r0, r1, r2
}
// QueryUsersForResource provides a mock function with given fields: rctx, resourceID, action, opts
func (_m *AccessControlServiceInterface) QueryUsersForResource(rctx request.CTX, resourceID string, action string, opts model.SubjectSearchOptions) ([]*model.User, int64, *model.AppError) {
ret := _m.Called(rctx, resourceID, action, opts)
if len(ret) == 0 {
panic("no return value specified for QueryUsersForResource")
}
var r0 []*model.User
var r1 int64
var r2 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, string, model.SubjectSearchOptions) ([]*model.User, int64, *model.AppError)); ok {
return rf(rctx, resourceID, action, opts)
}
if rf, ok := ret.Get(0).(func(request.CTX, string, string, model.SubjectSearchOptions) []*model.User); ok {
r0 = rf(rctx, resourceID, action, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.User)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string, string, model.SubjectSearchOptions) int64); ok {
r1 = rf(rctx, resourceID, action, opts)
} else {
r1 = ret.Get(1).(int64)
}
if rf, ok := ret.Get(2).(func(request.CTX, string, string, model.SubjectSearchOptions) *model.AppError); ok {
r2 = rf(rctx, resourceID, action, opts)
} else {
if ret.Get(2) != nil {
r2 = ret.Get(2).(*model.AppError)
}
}
return r0, r1, r2
}
// SavePolicy provides a mock function with given fields: rctx, policy
func (_m *AccessControlServiceInterface) SavePolicy(rctx request.CTX, policy *model.AccessControlPolicy) (*model.AccessControlPolicy, *model.AppError) {
ret := _m.Called(rctx, policy)
if len(ret) == 0 {
panic("no return value specified for SavePolicy")
}
var r0 *model.AccessControlPolicy
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, *model.AccessControlPolicy) (*model.AccessControlPolicy, *model.AppError)); ok {
return rf(rctx, policy)
}
if rf, ok := ret.Get(0).(func(request.CTX, *model.AccessControlPolicy) *model.AccessControlPolicy); ok {
r0 = rf(rctx, policy)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AccessControlPolicy)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, *model.AccessControlPolicy) *model.AppError); ok {
r1 = rf(rctx, policy)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// SimulatePolicyForUsers provides a mock function with given fields: rctx, params
func (_m *AccessControlServiceInterface) SimulatePolicyForUsers(rctx request.CTX, params model.PolicySimulationByUsersParams) (*model.PolicySimulationResponse, *model.AppError) {
ret := _m.Called(rctx, params)
if len(ret) == 0 {
panic("no return value specified for SimulatePolicyForUsers")
}
var r0 *model.PolicySimulationResponse
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, model.PolicySimulationByUsersParams) (*model.PolicySimulationResponse, *model.AppError)); ok {
return rf(rctx, params)
}
if rf, ok := ret.Get(0).(func(request.CTX, model.PolicySimulationByUsersParams) *model.PolicySimulationResponse); ok {
r0 = rf(rctx, params)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.PolicySimulationResponse)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, model.PolicySimulationByUsersParams) *model.AppError); ok {
r1 = rf(rctx, params)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// ValidateExpressionValuesForCaller provides a mock function with given fields: rctx, expression, resolver
func (_m *AccessControlServiceInterface) ValidateExpressionValuesForCaller(rctx request.CTX, expression string, resolver model.MaskingFieldResolver) *model.AppError {
ret := _m.Called(rctx, expression, resolver)
if len(ret) == 0 {
panic("no return value specified for ValidateExpressionValuesForCaller")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, model.MaskingFieldResolver) *model.AppError); ok {
r0 = rf(rctx, expression, resolver)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// NewAccessControlServiceInterface creates a new instance of AccessControlServiceInterface. 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 NewAccessControlServiceInterface(t interface {
mock.TestingT
Cleanup(func())
}) *AccessControlServiceInterface {
mock := &AccessControlServiceInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,70 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
jobs "github.com/mattermost/mattermost/server/v8/einterfaces/jobs"
mock "github.com/stretchr/testify/mock"
)
// AccessControlSyncJobInterface is an autogenerated mock type for the AccessControlSyncJobInterface type
type AccessControlSyncJobInterface struct {
mock.Mock
}
// MakeScheduler provides a mock function with no fields
func (_m *AccessControlSyncJobInterface) MakeScheduler() jobs.Scheduler {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeScheduler")
}
var r0 jobs.Scheduler
if rf, ok := ret.Get(0).(func() jobs.Scheduler); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(jobs.Scheduler)
}
}
return r0
}
// MakeWorker provides a mock function with no fields
func (_m *AccessControlSyncJobInterface) MakeWorker() model.Worker {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeWorker")
}
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
// NewAccessControlSyncJobInterface creates a new instance of AccessControlSyncJobInterface. 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 NewAccessControlSyncJobInterface(t interface {
mock.TestingT
Cleanup(func())
}) *AccessControlSyncJobInterface {
mock := &AccessControlSyncJobInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,70 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
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"
)
// AccountMigrationInterface is an autogenerated mock type for the AccountMigrationInterface type
type AccountMigrationInterface struct {
mock.Mock
}
// MigrateToLdap provides a mock function with given fields: rctx, fromAuthService, foreignUserFieldNameToMatch, force, dryRun
func (_m *AccountMigrationInterface) MigrateToLdap(rctx request.CTX, fromAuthService string, foreignUserFieldNameToMatch string, force bool, dryRun bool) *model.AppError {
ret := _m.Called(rctx, fromAuthService, foreignUserFieldNameToMatch, force, dryRun)
if len(ret) == 0 {
panic("no return value specified for MigrateToLdap")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, string, bool, bool) *model.AppError); ok {
r0 = rf(rctx, fromAuthService, foreignUserFieldNameToMatch, force, dryRun)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// MigrateToSaml provides a mock function with given fields: rctx, fromAuthService, usersMap, auto, dryRun
func (_m *AccountMigrationInterface) MigrateToSaml(rctx request.CTX, fromAuthService string, usersMap map[string]string, auto bool, dryRun bool) *model.AppError {
ret := _m.Called(rctx, fromAuthService, usersMap, auto, dryRun)
if len(ret) == 0 {
panic("no return value specified for MigrateToSaml")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, map[string]string, bool, bool) *model.AppError); ok {
r0 = rf(rctx, fromAuthService, usersMap, auto, dryRun)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// NewAccountMigrationInterface creates a new instance of AccountMigrationInterface. 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 NewAccountMigrationInterface(t interface {
mock.TestingT
Cleanup(func())
}) *AccountMigrationInterface {
mock := &AccountMigrationInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,337 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
context "context"
model "github.com/mattermost/mattermost/server/public/model"
jobs "github.com/mattermost/mattermost/server/v8/einterfaces/jobs"
mock "github.com/stretchr/testify/mock"
)
// AutoTranslationInterface is an autogenerated mock type for the AutoTranslationInterface type
type AutoTranslationInterface struct {
mock.Mock
}
// Close provides a mock function with no fields
func (_m *AutoTranslationInterface) Close() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Close")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// DetectRemote provides a mock function with given fields: ctx, text
func (_m *AutoTranslationInterface) DetectRemote(ctx context.Context, text string) (string, *float64, *model.AppError) {
ret := _m.Called(ctx, text)
if len(ret) == 0 {
panic("no return value specified for DetectRemote")
}
var r0 string
var r1 *float64
var r2 *model.AppError
if rf, ok := ret.Get(0).(func(context.Context, string) (string, *float64, *model.AppError)); ok {
return rf(ctx, text)
}
if rf, ok := ret.Get(0).(func(context.Context, string) string); ok {
r0 = rf(ctx, text)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(context.Context, string) *float64); ok {
r1 = rf(ctx, text)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*float64)
}
}
if rf, ok := ret.Get(2).(func(context.Context, string) *model.AppError); ok {
r2 = rf(ctx, text)
} else {
if ret.Get(2) != nil {
r2 = ret.Get(2).(*model.AppError)
}
}
return r0, r1, r2
}
// GetBatch provides a mock function with given fields: objectType, objectIDs, dstLang
func (_m *AutoTranslationInterface) GetBatch(objectType string, objectIDs []string, dstLang string) (map[string]*model.Translation, *model.AppError) {
ret := _m.Called(objectType, objectIDs, dstLang)
if len(ret) == 0 {
panic("no return value specified for GetBatch")
}
var r0 map[string]*model.Translation
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, []string, string) (map[string]*model.Translation, *model.AppError)); ok {
return rf(objectType, objectIDs, dstLang)
}
if rf, ok := ret.Get(0).(func(string, []string, string) map[string]*model.Translation); ok {
r0 = rf(objectType, objectIDs, dstLang)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[string]*model.Translation)
}
}
if rf, ok := ret.Get(1).(func(string, []string, string) *model.AppError); ok {
r1 = rf(objectType, objectIDs, dstLang)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetUserLanguage provides a mock function with given fields: userID, channelID
func (_m *AutoTranslationInterface) GetUserLanguage(userID string, channelID string) (string, *model.AppError) {
ret := _m.Called(userID, channelID)
if len(ret) == 0 {
panic("no return value specified for GetUserLanguage")
}
var r0 string
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, string) (string, *model.AppError)); ok {
return rf(userID, channelID)
}
if rf, ok := ret.Get(0).(func(string, string) string); ok {
r0 = rf(userID, channelID)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(string, string) *model.AppError); ok {
r1 = rf(userID, channelID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// IsChannelEnabled provides a mock function with given fields: channelID
func (_m *AutoTranslationInterface) IsChannelEnabled(channelID string) (bool, *model.AppError) {
ret := _m.Called(channelID)
if len(ret) == 0 {
panic("no return value specified for IsChannelEnabled")
}
var r0 bool
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string) (bool, *model.AppError)); ok {
return rf(channelID)
}
if rf, ok := ret.Get(0).(func(string) bool); ok {
r0 = rf(channelID)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
r1 = rf(channelID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// IsFeatureAvailable provides a mock function with no fields
func (_m *AutoTranslationInterface) IsFeatureAvailable() bool {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for IsFeatureAvailable")
}
var r0 bool
if rf, ok := ret.Get(0).(func() bool); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// IsUserEnabled provides a mock function with given fields: channelID, userID
func (_m *AutoTranslationInterface) IsUserEnabled(channelID string, userID string) (bool, *model.AppError) {
ret := _m.Called(channelID, userID)
if len(ret) == 0 {
panic("no return value specified for IsUserEnabled")
}
var r0 bool
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, string) (bool, *model.AppError)); ok {
return rf(channelID, userID)
}
if rf, ok := ret.Get(0).(func(string, string) bool); ok {
r0 = rf(channelID, userID)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(string, string) *model.AppError); ok {
r1 = rf(channelID, userID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// MakeScheduler provides a mock function with no fields
func (_m *AutoTranslationInterface) MakeScheduler() jobs.Scheduler {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeScheduler")
}
var r0 jobs.Scheduler
if rf, ok := ret.Get(0).(func() jobs.Scheduler); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(jobs.Scheduler)
}
}
return r0
}
// MakeWorker provides a mock function with no fields
func (_m *AutoTranslationInterface) MakeWorker() model.Worker {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeWorker")
}
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
// Shutdown provides a mock function with no fields
func (_m *AutoTranslationInterface) Shutdown() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Shutdown")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// Start provides a mock function with no fields
func (_m *AutoTranslationInterface) Start() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Start")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// Translate provides a mock function with given fields: ctx, objectType, objectID, channelID, userID, content
func (_m *AutoTranslationInterface) Translate(ctx context.Context, objectType string, objectID string, channelID string, userID string, content interface{}) (*model.Translation, *model.AppError) {
ret := _m.Called(ctx, objectType, objectID, channelID, userID, content)
if len(ret) == 0 {
panic("no return value specified for Translate")
}
var r0 *model.Translation
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, interface{}) (*model.Translation, *model.AppError)); ok {
return rf(ctx, objectType, objectID, channelID, userID, content)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, interface{}) *model.Translation); ok {
r0 = rf(ctx, objectType, objectID, channelID, userID, content)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Translation)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string, interface{}) *model.AppError); ok {
r1 = rf(ctx, objectType, objectID, channelID, userID, content)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// NewAutoTranslationInterface creates a new instance of AutoTranslationInterface. 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 NewAutoTranslationInterface(t interface {
mock.TestingT
Cleanup(func())
}) *AutoTranslationInterface {
mock := &AutoTranslationInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,596 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
multipart "mime/multipart"
model "github.com/mattermost/mattermost/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// CloudInterface is an autogenerated mock type for the CloudInterface type
type CloudInterface struct {
mock.Mock
}
// ApplyIPFilters provides a mock function with given fields: userID, ranges
func (_m *CloudInterface) ApplyIPFilters(userID string, ranges *model.AllowedIPRanges) (*model.AllowedIPRanges, error) {
ret := _m.Called(userID, ranges)
if len(ret) == 0 {
panic("no return value specified for ApplyIPFilters")
}
var r0 *model.AllowedIPRanges
var r1 error
if rf, ok := ret.Get(0).(func(string, *model.AllowedIPRanges) (*model.AllowedIPRanges, error)); ok {
return rf(userID, ranges)
}
if rf, ok := ret.Get(0).(func(string, *model.AllowedIPRanges) *model.AllowedIPRanges); ok {
r0 = rf(userID, ranges)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AllowedIPRanges)
}
}
if rf, ok := ret.Get(1).(func(string, *model.AllowedIPRanges) error); ok {
r1 = rf(userID, ranges)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ChangeSubscription provides a mock function with given fields: userID, subscriptionID, subscriptionChange
func (_m *CloudInterface) ChangeSubscription(userID string, subscriptionID string, subscriptionChange *model.SubscriptionChange) (*model.Subscription, error) {
ret := _m.Called(userID, subscriptionID, subscriptionChange)
if len(ret) == 0 {
panic("no return value specified for ChangeSubscription")
}
var r0 *model.Subscription
var r1 error
if rf, ok := ret.Get(0).(func(string, string, *model.SubscriptionChange) (*model.Subscription, error)); ok {
return rf(userID, subscriptionID, subscriptionChange)
}
if rf, ok := ret.Get(0).(func(string, string, *model.SubscriptionChange) *model.Subscription); ok {
r0 = rf(userID, subscriptionID, subscriptionChange)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Subscription)
}
}
if rf, ok := ret.Get(1).(func(string, string, *model.SubscriptionChange) error); ok {
r1 = rf(userID, subscriptionID, subscriptionChange)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CheckCWSConnection provides a mock function with given fields: userId
func (_m *CloudInterface) CheckCWSConnection(userId string) error {
ret := _m.Called(userId)
if len(ret) == 0 {
panic("no return value specified for CheckCWSConnection")
}
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(userId)
} else {
r0 = ret.Error(0)
}
return r0
}
// CreateAuditLoggingCert provides a mock function with given fields: userID, fileData
func (_m *CloudInterface) CreateAuditLoggingCert(userID string, fileData *multipart.FileHeader) error {
ret := _m.Called(userID, fileData)
if len(ret) == 0 {
panic("no return value specified for CreateAuditLoggingCert")
}
var r0 error
if rf, ok := ret.Get(0).(func(string, *multipart.FileHeader) error); ok {
r0 = rf(userID, fileData)
} else {
r0 = ret.Error(0)
}
return r0
}
// CreateOrUpdateSubscriptionHistoryEvent provides a mock function with given fields: userID, userCount
func (_m *CloudInterface) CreateOrUpdateSubscriptionHistoryEvent(userID string, userCount int) (*model.SubscriptionHistory, error) {
ret := _m.Called(userID, userCount)
if len(ret) == 0 {
panic("no return value specified for CreateOrUpdateSubscriptionHistoryEvent")
}
var r0 *model.SubscriptionHistory
var r1 error
if rf, ok := ret.Get(0).(func(string, int) (*model.SubscriptionHistory, error)); ok {
return rf(userID, userCount)
}
if rf, ok := ret.Get(0).(func(string, int) *model.SubscriptionHistory); ok {
r0 = rf(userID, userCount)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.SubscriptionHistory)
}
}
if rf, ok := ret.Get(1).(func(string, int) error); ok {
r1 = rf(userID, userCount)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetCloudCustomer provides a mock function with given fields: userID
func (_m *CloudInterface) GetCloudCustomer(userID string) (*model.CloudCustomer, error) {
ret := _m.Called(userID)
if len(ret) == 0 {
panic("no return value specified for GetCloudCustomer")
}
var r0 *model.CloudCustomer
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.CloudCustomer, error)); ok {
return rf(userID)
}
if rf, ok := ret.Get(0).(func(string) *model.CloudCustomer); ok {
r0 = rf(userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.CloudCustomer)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(userID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetCloudLimits provides a mock function with given fields: userID
func (_m *CloudInterface) GetCloudLimits(userID string) (*model.ProductLimits, error) {
ret := _m.Called(userID)
if len(ret) == 0 {
panic("no return value specified for GetCloudLimits")
}
var r0 *model.ProductLimits
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.ProductLimits, error)); ok {
return rf(userID)
}
if rf, ok := ret.Get(0).(func(string) *model.ProductLimits); ok {
r0 = rf(userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.ProductLimits)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(userID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetCloudProduct provides a mock function with given fields: userID, productID
func (_m *CloudInterface) GetCloudProduct(userID string, productID string) (*model.Product, error) {
ret := _m.Called(userID, productID)
if len(ret) == 0 {
panic("no return value specified for GetCloudProduct")
}
var r0 *model.Product
var r1 error
if rf, ok := ret.Get(0).(func(string, string) (*model.Product, error)); ok {
return rf(userID, productID)
}
if rf, ok := ret.Get(0).(func(string, string) *model.Product); ok {
r0 = rf(userID, productID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Product)
}
}
if rf, ok := ret.Get(1).(func(string, string) error); ok {
r1 = rf(userID, productID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetCloudProducts provides a mock function with given fields: userID, includeLegacyProducts
func (_m *CloudInterface) GetCloudProducts(userID string, includeLegacyProducts bool) ([]*model.Product, error) {
ret := _m.Called(userID, includeLegacyProducts)
if len(ret) == 0 {
panic("no return value specified for GetCloudProducts")
}
var r0 []*model.Product
var r1 error
if rf, ok := ret.Get(0).(func(string, bool) ([]*model.Product, error)); ok {
return rf(userID, includeLegacyProducts)
}
if rf, ok := ret.Get(0).(func(string, bool) []*model.Product); ok {
r0 = rf(userID, includeLegacyProducts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Product)
}
}
if rf, ok := ret.Get(1).(func(string, bool) error); ok {
r1 = rf(userID, includeLegacyProducts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetIPFilters provides a mock function with given fields: userID
func (_m *CloudInterface) GetIPFilters(userID string) (*model.AllowedIPRanges, error) {
ret := _m.Called(userID)
if len(ret) == 0 {
panic("no return value specified for GetIPFilters")
}
var r0 *model.AllowedIPRanges
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.AllowedIPRanges, error)); ok {
return rf(userID)
}
if rf, ok := ret.Get(0).(func(string) *model.AllowedIPRanges); ok {
r0 = rf(userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AllowedIPRanges)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(userID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetInstallation provides a mock function with given fields: userID
func (_m *CloudInterface) GetInstallation(userID string) (*model.Installation, error) {
ret := _m.Called(userID)
if len(ret) == 0 {
panic("no return value specified for GetInstallation")
}
var r0 *model.Installation
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.Installation, error)); ok {
return rf(userID)
}
if rf, ok := ret.Get(0).(func(string) *model.Installation); ok {
r0 = rf(userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Installation)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(userID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetInvoicePDF provides a mock function with given fields: userID, invoiceID
func (_m *CloudInterface) GetInvoicePDF(userID string, invoiceID string) ([]byte, string, error) {
ret := _m.Called(userID, invoiceID)
if len(ret) == 0 {
panic("no return value specified for GetInvoicePDF")
}
var r0 []byte
var r1 string
var r2 error
if rf, ok := ret.Get(0).(func(string, string) ([]byte, string, error)); ok {
return rf(userID, invoiceID)
}
if rf, ok := ret.Get(0).(func(string, string) []byte); ok {
r0 = rf(userID, invoiceID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
if rf, ok := ret.Get(1).(func(string, string) string); ok {
r1 = rf(userID, invoiceID)
} else {
r1 = ret.Get(1).(string)
}
if rf, ok := ret.Get(2).(func(string, string) error); ok {
r2 = rf(userID, invoiceID)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// GetInvoicesForSubscription provides a mock function with given fields: userID
func (_m *CloudInterface) GetInvoicesForSubscription(userID string) ([]*model.Invoice, error) {
ret := _m.Called(userID)
if len(ret) == 0 {
panic("no return value specified for GetInvoicesForSubscription")
}
var r0 []*model.Invoice
var r1 error
if rf, ok := ret.Get(0).(func(string) ([]*model.Invoice, error)); ok {
return rf(userID)
}
if rf, ok := ret.Get(0).(func(string) []*model.Invoice); ok {
r0 = rf(userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Invoice)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(userID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetSelfHostedProducts provides a mock function with given fields: userID
func (_m *CloudInterface) GetSelfHostedProducts(userID string) ([]*model.Product, error) {
ret := _m.Called(userID)
if len(ret) == 0 {
panic("no return value specified for GetSelfHostedProducts")
}
var r0 []*model.Product
var r1 error
if rf, ok := ret.Get(0).(func(string) ([]*model.Product, error)); ok {
return rf(userID)
}
if rf, ok := ret.Get(0).(func(string) []*model.Product); ok {
r0 = rf(userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Product)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(userID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetSubscription provides a mock function with given fields: userID
func (_m *CloudInterface) GetSubscription(userID string) (*model.Subscription, error) {
ret := _m.Called(userID)
if len(ret) == 0 {
panic("no return value specified for GetSubscription")
}
var r0 *model.Subscription
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.Subscription, error)); ok {
return rf(userID)
}
if rf, ok := ret.Get(0).(func(string) *model.Subscription); ok {
r0 = rf(userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Subscription)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(userID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// HandleLicenseChange provides a mock function with no fields
func (_m *CloudInterface) HandleLicenseChange() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for HandleLicenseChange")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// InvalidateCaches provides a mock function with no fields
func (_m *CloudInterface) InvalidateCaches() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for InvalidateCaches")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// RemoveAuditLoggingCert provides a mock function with given fields: userID
func (_m *CloudInterface) RemoveAuditLoggingCert(userID string) error {
ret := _m.Called(userID)
if len(ret) == 0 {
panic("no return value specified for RemoveAuditLoggingCert")
}
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(userID)
} else {
r0 = ret.Error(0)
}
return r0
}
// UpdateCloudCustomer provides a mock function with given fields: userID, customerInfo
func (_m *CloudInterface) UpdateCloudCustomer(userID string, customerInfo *model.CloudCustomerInfo) (*model.CloudCustomer, error) {
ret := _m.Called(userID, customerInfo)
if len(ret) == 0 {
panic("no return value specified for UpdateCloudCustomer")
}
var r0 *model.CloudCustomer
var r1 error
if rf, ok := ret.Get(0).(func(string, *model.CloudCustomerInfo) (*model.CloudCustomer, error)); ok {
return rf(userID, customerInfo)
}
if rf, ok := ret.Get(0).(func(string, *model.CloudCustomerInfo) *model.CloudCustomer); ok {
r0 = rf(userID, customerInfo)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.CloudCustomer)
}
}
if rf, ok := ret.Get(1).(func(string, *model.CloudCustomerInfo) error); ok {
r1 = rf(userID, customerInfo)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UpdateCloudCustomerAddress provides a mock function with given fields: userID, address
func (_m *CloudInterface) UpdateCloudCustomerAddress(userID string, address *model.Address) (*model.CloudCustomer, error) {
ret := _m.Called(userID, address)
if len(ret) == 0 {
panic("no return value specified for UpdateCloudCustomerAddress")
}
var r0 *model.CloudCustomer
var r1 error
if rf, ok := ret.Get(0).(func(string, *model.Address) (*model.CloudCustomer, error)); ok {
return rf(userID, address)
}
if rf, ok := ret.Get(0).(func(string, *model.Address) *model.CloudCustomer); ok {
r0 = rf(userID, address)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.CloudCustomer)
}
}
if rf, ok := ret.Get(1).(func(string, *model.Address) error); ok {
r1 = rf(userID, address)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ValidateBusinessEmail provides a mock function with given fields: userID, email
func (_m *CloudInterface) ValidateBusinessEmail(userID string, email string) error {
ret := _m.Called(userID, email)
if len(ret) == 0 {
panic("no return value specified for ValidateBusinessEmail")
}
var r0 error
if rf, ok := ret.Get(0).(func(string, string) error); ok {
r0 = rf(userID, email)
} else {
r0 = ret.Error(0)
}
return r0
}
// NewCloudInterface creates a new instance of CloudInterface. 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 NewCloudInterface(t interface {
mock.TestingT
Cleanup(func())
}) *CloudInterface {
mock := &CloudInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,70 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
jobs "github.com/mattermost/mattermost/server/v8/einterfaces/jobs"
mock "github.com/stretchr/testify/mock"
)
// CloudJobInterface is an autogenerated mock type for the CloudJobInterface type
type CloudJobInterface struct {
mock.Mock
}
// MakeScheduler provides a mock function with no fields
func (_m *CloudJobInterface) MakeScheduler() jobs.Scheduler {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeScheduler")
}
var r0 jobs.Scheduler
if rf, ok := ret.Get(0).(func() jobs.Scheduler); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(jobs.Scheduler)
}
}
return r0
}
// MakeWorker provides a mock function with no fields
func (_m *CloudJobInterface) MakeWorker() model.Worker {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeWorker")
}
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
// NewCloudJobInterface creates a new instance of CloudJobInterface. 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 NewCloudJobInterface(t interface {
mock.TestingT
Cleanup(func())
}) *CloudJobInterface {
mock := &CloudJobInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,421 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
request "github.com/mattermost/mattermost/server/public/shared/request"
einterfaces "github.com/mattermost/mattermost/server/v8/einterfaces"
mock "github.com/stretchr/testify/mock"
)
// ClusterInterface is an autogenerated mock type for the ClusterInterface type
type ClusterInterface struct {
mock.Mock
}
// ConfigChanged provides a mock function with given fields: previousConfig, newConfig, sendToOtherServer
func (_m *ClusterInterface) ConfigChanged(previousConfig *model.Config, newConfig *model.Config, sendToOtherServer bool) *model.AppError {
ret := _m.Called(previousConfig, newConfig, sendToOtherServer)
if len(ret) == 0 {
panic("no return value specified for ConfigChanged")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(*model.Config, *model.Config, bool) *model.AppError); ok {
r0 = rf(previousConfig, newConfig, sendToOtherServer)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// GenerateSupportPacket provides a mock function with given fields: rctx, options
func (_m *ClusterInterface) GenerateSupportPacket(rctx request.CTX, options *model.SupportPacketOptions) (map[string][]model.FileData, error) {
ret := _m.Called(rctx, options)
if len(ret) == 0 {
panic("no return value specified for GenerateSupportPacket")
}
var r0 map[string][]model.FileData
var r1 error
if rf, ok := ret.Get(0).(func(request.CTX, *model.SupportPacketOptions) (map[string][]model.FileData, error)); ok {
return rf(rctx, options)
}
if rf, ok := ret.Get(0).(func(request.CTX, *model.SupportPacketOptions) map[string][]model.FileData); ok {
r0 = rf(rctx, options)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[string][]model.FileData)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, *model.SupportPacketOptions) error); ok {
r1 = rf(rctx, options)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetClusterId provides a mock function with no fields
func (_m *ClusterInterface) GetClusterId() string {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetClusterId")
}
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// GetClusterInfos provides a mock function with no fields
func (_m *ClusterInterface) GetClusterInfos() ([]*model.ClusterInfo, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetClusterInfos")
}
var r0 []*model.ClusterInfo
var r1 error
if rf, ok := ret.Get(0).(func() ([]*model.ClusterInfo, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() []*model.ClusterInfo); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.ClusterInfo)
}
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetClusterStats provides a mock function with given fields: rctx
func (_m *ClusterInterface) GetClusterStats(rctx request.CTX) ([]*model.ClusterStats, *model.AppError) {
ret := _m.Called(rctx)
if len(ret) == 0 {
panic("no return value specified for GetClusterStats")
}
var r0 []*model.ClusterStats
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX) ([]*model.ClusterStats, *model.AppError)); ok {
return rf(rctx)
}
if rf, ok := ret.Get(0).(func(request.CTX) []*model.ClusterStats); ok {
r0 = rf(rctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.ClusterStats)
}
}
if rf, ok := ret.Get(1).(func(request.CTX) *model.AppError); ok {
r1 = rf(rctx)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetLogs provides a mock function with given fields: rctx, page, perPage
func (_m *ClusterInterface) GetLogs(rctx request.CTX, page int, perPage int) ([]string, *model.AppError) {
ret := _m.Called(rctx, page, perPage)
if len(ret) == 0 {
panic("no return value specified for GetLogs")
}
var r0 []string
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, int, int) ([]string, *model.AppError)); ok {
return rf(rctx, page, perPage)
}
if rf, ok := ret.Get(0).(func(request.CTX, int, int) []string); ok {
r0 = rf(rctx, page, perPage)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, int, int) *model.AppError); ok {
r1 = rf(rctx, page, perPage)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetMyClusterInfo provides a mock function with no fields
func (_m *ClusterInterface) GetMyClusterInfo() *model.ClusterInfo {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetMyClusterInfo")
}
var r0 *model.ClusterInfo
if rf, ok := ret.Get(0).(func() *model.ClusterInfo); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.ClusterInfo)
}
}
return r0
}
// GetPluginStatuses provides a mock function with no fields
func (_m *ClusterInterface) GetPluginStatuses() (model.PluginStatuses, *model.AppError) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetPluginStatuses")
}
var r0 model.PluginStatuses
var r1 *model.AppError
if rf, ok := ret.Get(0).(func() (model.PluginStatuses, *model.AppError)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() model.PluginStatuses); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.PluginStatuses)
}
}
if rf, ok := ret.Get(1).(func() *model.AppError); ok {
r1 = rf()
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetWSQueues provides a mock function with given fields: userID, connectionID, seqNum
func (_m *ClusterInterface) GetWSQueues(userID string, connectionID string, seqNum int64) (map[string]*model.WSQueues, error) {
ret := _m.Called(userID, connectionID, seqNum)
if len(ret) == 0 {
panic("no return value specified for GetWSQueues")
}
var r0 map[string]*model.WSQueues
var r1 error
if rf, ok := ret.Get(0).(func(string, string, int64) (map[string]*model.WSQueues, error)); ok {
return rf(userID, connectionID, seqNum)
}
if rf, ok := ret.Get(0).(func(string, string, int64) map[string]*model.WSQueues); ok {
r0 = rf(userID, connectionID, seqNum)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[string]*model.WSQueues)
}
}
if rf, ok := ret.Get(1).(func(string, string, int64) error); ok {
r1 = rf(userID, connectionID, seqNum)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// HealthScore provides a mock function with no fields
func (_m *ClusterInterface) HealthScore() int {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for HealthScore")
}
var r0 int
if rf, ok := ret.Get(0).(func() int); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(int)
}
return r0
}
// IsLeader provides a mock function with no fields
func (_m *ClusterInterface) IsLeader() bool {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for IsLeader")
}
var r0 bool
if rf, ok := ret.Get(0).(func() bool); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// NotifyMsg provides a mock function with given fields: buf
func (_m *ClusterInterface) NotifyMsg(buf []byte) {
_m.Called(buf)
}
// QueryLogs provides a mock function with given fields: rctx, page, perPage
func (_m *ClusterInterface) QueryLogs(rctx request.CTX, page int, perPage int) (map[string][]string, *model.AppError) {
ret := _m.Called(rctx, page, perPage)
if len(ret) == 0 {
panic("no return value specified for QueryLogs")
}
var r0 map[string][]string
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, int, int) (map[string][]string, *model.AppError)); ok {
return rf(rctx, page, perPage)
}
if rf, ok := ret.Get(0).(func(request.CTX, int, int) map[string][]string); ok {
r0 = rf(rctx, page, perPage)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[string][]string)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, int, int) *model.AppError); ok {
r1 = rf(rctx, page, perPage)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// RegisterClusterMessageHandler provides a mock function with given fields: event, crm
func (_m *ClusterInterface) RegisterClusterMessageHandler(event model.ClusterEvent, crm einterfaces.ClusterMessageHandler) {
_m.Called(event, crm)
}
// SendClusterMessage provides a mock function with given fields: msg
func (_m *ClusterInterface) SendClusterMessage(msg *model.ClusterMessage) {
_m.Called(msg)
}
// SendClusterMessageToNode provides a mock function with given fields: nodeID, msg
func (_m *ClusterInterface) SendClusterMessageToNode(nodeID string, msg *model.ClusterMessage) error {
ret := _m.Called(nodeID, msg)
if len(ret) == 0 {
panic("no return value specified for SendClusterMessageToNode")
}
var r0 error
if rf, ok := ret.Get(0).(func(string, *model.ClusterMessage) error); ok {
r0 = rf(nodeID, msg)
} else {
r0 = ret.Error(0)
}
return r0
}
// Shutdown provides a mock function with no fields
func (_m *ClusterInterface) Shutdown() {
_m.Called()
}
// StartInterNodeCommunication provides a mock function with no fields
func (_m *ClusterInterface) StartInterNodeCommunication() {
_m.Called()
}
// StopInterNodeCommunication provides a mock function with no fields
func (_m *ClusterInterface) StopInterNodeCommunication() {
_m.Called()
}
// WebConnCountForUser provides a mock function with given fields: userID
func (_m *ClusterInterface) WebConnCountForUser(userID string) (int, *model.AppError) {
ret := _m.Called(userID)
if len(ret) == 0 {
panic("no return value specified for WebConnCountForUser")
}
var r0 int
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string) (int, *model.AppError)); ok {
return rf(userID)
}
if rf, ok := ret.Get(0).(func(string) int); ok {
r0 = rf(userID)
} else {
r0 = ret.Get(0).(int)
}
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
r1 = rf(userID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// NewClusterInterface creates a new instance of ClusterInterface. 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 NewClusterInterface(t interface {
mock.TestingT
Cleanup(func())
}) *ClusterInterface {
mock := &ClusterInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,34 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// ClusterMessageHandler is an autogenerated mock type for the ClusterMessageHandler type
type ClusterMessageHandler struct {
mock.Mock
}
// Execute provides a mock function with given fields: msg
func (_m *ClusterMessageHandler) Execute(msg *model.ClusterMessage) {
_m.Called(msg)
}
// NewClusterMessageHandler creates a new instance of ClusterMessageHandler. 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 NewClusterMessageHandler(t interface {
mock.TestingT
Cleanup(func())
}) *ClusterMessageHandler {
mock := &ClusterMessageHandler{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,55 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
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"
)
// ComplianceInterface is an autogenerated mock type for the ComplianceInterface type
type ComplianceInterface struct {
mock.Mock
}
// RunComplianceJob provides a mock function with given fields: rctx, job
func (_m *ComplianceInterface) RunComplianceJob(rctx request.CTX, job *model.Compliance) *model.AppError {
ret := _m.Called(rctx, job)
if len(ret) == 0 {
panic("no return value specified for RunComplianceJob")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, *model.Compliance) *model.AppError); ok {
r0 = rf(rctx, job)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// StartComplianceDailyJob provides a mock function with no fields
func (_m *ComplianceInterface) StartComplianceDailyJob() {
_m.Called()
}
// NewComplianceInterface creates a new instance of ComplianceInterface. 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 NewComplianceInterface(t interface {
mock.TestingT
Cleanup(func())
}) *ComplianceInterface {
mock := &ComplianceInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,447 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// DataRetentionInterface is an autogenerated mock type for the DataRetentionInterface type
type DataRetentionInterface struct {
mock.Mock
}
// AddChannelsToPolicy provides a mock function with given fields: policyID, channelIDs
func (_m *DataRetentionInterface) AddChannelsToPolicy(policyID string, channelIDs []string) *model.AppError {
ret := _m.Called(policyID, channelIDs)
if len(ret) == 0 {
panic("no return value specified for AddChannelsToPolicy")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, []string) *model.AppError); ok {
r0 = rf(policyID, channelIDs)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// AddTeamsToPolicy provides a mock function with given fields: policyID, teamIDs
func (_m *DataRetentionInterface) AddTeamsToPolicy(policyID string, teamIDs []string) *model.AppError {
ret := _m.Called(policyID, teamIDs)
if len(ret) == 0 {
panic("no return value specified for AddTeamsToPolicy")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, []string) *model.AppError); ok {
r0 = rf(policyID, teamIDs)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// CreatePolicy provides a mock function with given fields: policy
func (_m *DataRetentionInterface) CreatePolicy(policy *model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError) {
ret := _m.Called(policy)
if len(ret) == 0 {
panic("no return value specified for CreatePolicy")
}
var r0 *model.RetentionPolicyWithTeamAndChannelCounts
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(*model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError)); ok {
return rf(policy)
}
if rf, ok := ret.Get(0).(func(*model.RetentionPolicyWithTeamAndChannelIDs) *model.RetentionPolicyWithTeamAndChannelCounts); ok {
r0 = rf(policy)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.RetentionPolicyWithTeamAndChannelCounts)
}
}
if rf, ok := ret.Get(1).(func(*model.RetentionPolicyWithTeamAndChannelIDs) *model.AppError); ok {
r1 = rf(policy)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// DeletePolicy provides a mock function with given fields: policyID
func (_m *DataRetentionInterface) DeletePolicy(policyID string) *model.AppError {
ret := _m.Called(policyID)
if len(ret) == 0 {
panic("no return value specified for DeletePolicy")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string) *model.AppError); ok {
r0 = rf(policyID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// GetChannelPoliciesForUser provides a mock function with given fields: userID, offset, limit
func (_m *DataRetentionInterface) GetChannelPoliciesForUser(userID string, offset int, limit int) (*model.RetentionPolicyForChannelList, *model.AppError) {
ret := _m.Called(userID, offset, limit)
if len(ret) == 0 {
panic("no return value specified for GetChannelPoliciesForUser")
}
var r0 *model.RetentionPolicyForChannelList
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, int, int) (*model.RetentionPolicyForChannelList, *model.AppError)); ok {
return rf(userID, offset, limit)
}
if rf, ok := ret.Get(0).(func(string, int, int) *model.RetentionPolicyForChannelList); ok {
r0 = rf(userID, offset, limit)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.RetentionPolicyForChannelList)
}
}
if rf, ok := ret.Get(1).(func(string, int, int) *model.AppError); ok {
r1 = rf(userID, offset, limit)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetChannelsForPolicy provides a mock function with given fields: policyID, offset, limit
func (_m *DataRetentionInterface) GetChannelsForPolicy(policyID string, offset int, limit int) (*model.ChannelsWithCount, *model.AppError) {
ret := _m.Called(policyID, offset, limit)
if len(ret) == 0 {
panic("no return value specified for GetChannelsForPolicy")
}
var r0 *model.ChannelsWithCount
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, int, int) (*model.ChannelsWithCount, *model.AppError)); ok {
return rf(policyID, offset, limit)
}
if rf, ok := ret.Get(0).(func(string, int, int) *model.ChannelsWithCount); ok {
r0 = rf(policyID, offset, limit)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.ChannelsWithCount)
}
}
if rf, ok := ret.Get(1).(func(string, int, int) *model.AppError); ok {
r1 = rf(policyID, offset, limit)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetGlobalPolicy provides a mock function with no fields
func (_m *DataRetentionInterface) GetGlobalPolicy() (*model.GlobalRetentionPolicy, *model.AppError) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetGlobalPolicy")
}
var r0 *model.GlobalRetentionPolicy
var r1 *model.AppError
if rf, ok := ret.Get(0).(func() (*model.GlobalRetentionPolicy, *model.AppError)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() *model.GlobalRetentionPolicy); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.GlobalRetentionPolicy)
}
}
if rf, ok := ret.Get(1).(func() *model.AppError); ok {
r1 = rf()
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetPolicies provides a mock function with given fields: offset, limit
func (_m *DataRetentionInterface) GetPolicies(offset int, limit int) (*model.RetentionPolicyWithTeamAndChannelCountsList, *model.AppError) {
ret := _m.Called(offset, limit)
if len(ret) == 0 {
panic("no return value specified for GetPolicies")
}
var r0 *model.RetentionPolicyWithTeamAndChannelCountsList
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(int, int) (*model.RetentionPolicyWithTeamAndChannelCountsList, *model.AppError)); ok {
return rf(offset, limit)
}
if rf, ok := ret.Get(0).(func(int, int) *model.RetentionPolicyWithTeamAndChannelCountsList); ok {
r0 = rf(offset, limit)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.RetentionPolicyWithTeamAndChannelCountsList)
}
}
if rf, ok := ret.Get(1).(func(int, int) *model.AppError); ok {
r1 = rf(offset, limit)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetPoliciesCount provides a mock function with no fields
func (_m *DataRetentionInterface) GetPoliciesCount() (int64, *model.AppError) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetPoliciesCount")
}
var r0 int64
var r1 *model.AppError
if rf, ok := ret.Get(0).(func() (int64, *model.AppError)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() int64); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(int64)
}
if rf, ok := ret.Get(1).(func() *model.AppError); ok {
r1 = rf()
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetPolicy provides a mock function with given fields: policyID
func (_m *DataRetentionInterface) GetPolicy(policyID string) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError) {
ret := _m.Called(policyID)
if len(ret) == 0 {
panic("no return value specified for GetPolicy")
}
var r0 *model.RetentionPolicyWithTeamAndChannelCounts
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError)); ok {
return rf(policyID)
}
if rf, ok := ret.Get(0).(func(string) *model.RetentionPolicyWithTeamAndChannelCounts); ok {
r0 = rf(policyID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.RetentionPolicyWithTeamAndChannelCounts)
}
}
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
r1 = rf(policyID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetTeamPoliciesForUser provides a mock function with given fields: userID, offset, limit
func (_m *DataRetentionInterface) GetTeamPoliciesForUser(userID string, offset int, limit int) (*model.RetentionPolicyForTeamList, *model.AppError) {
ret := _m.Called(userID, offset, limit)
if len(ret) == 0 {
panic("no return value specified for GetTeamPoliciesForUser")
}
var r0 *model.RetentionPolicyForTeamList
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, int, int) (*model.RetentionPolicyForTeamList, *model.AppError)); ok {
return rf(userID, offset, limit)
}
if rf, ok := ret.Get(0).(func(string, int, int) *model.RetentionPolicyForTeamList); ok {
r0 = rf(userID, offset, limit)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.RetentionPolicyForTeamList)
}
}
if rf, ok := ret.Get(1).(func(string, int, int) *model.AppError); ok {
r1 = rf(userID, offset, limit)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetTeamsForPolicy provides a mock function with given fields: policyID, offset, limit
func (_m *DataRetentionInterface) GetTeamsForPolicy(policyID string, offset int, limit int) (*model.TeamsWithCount, *model.AppError) {
ret := _m.Called(policyID, offset, limit)
if len(ret) == 0 {
panic("no return value specified for GetTeamsForPolicy")
}
var r0 *model.TeamsWithCount
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, int, int) (*model.TeamsWithCount, *model.AppError)); ok {
return rf(policyID, offset, limit)
}
if rf, ok := ret.Get(0).(func(string, int, int) *model.TeamsWithCount); ok {
r0 = rf(policyID, offset, limit)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.TeamsWithCount)
}
}
if rf, ok := ret.Get(1).(func(string, int, int) *model.AppError); ok {
r1 = rf(policyID, offset, limit)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// PatchPolicy provides a mock function with given fields: patch
func (_m *DataRetentionInterface) PatchPolicy(patch *model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError) {
ret := _m.Called(patch)
if len(ret) == 0 {
panic("no return value specified for PatchPolicy")
}
var r0 *model.RetentionPolicyWithTeamAndChannelCounts
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(*model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError)); ok {
return rf(patch)
}
if rf, ok := ret.Get(0).(func(*model.RetentionPolicyWithTeamAndChannelIDs) *model.RetentionPolicyWithTeamAndChannelCounts); ok {
r0 = rf(patch)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.RetentionPolicyWithTeamAndChannelCounts)
}
}
if rf, ok := ret.Get(1).(func(*model.RetentionPolicyWithTeamAndChannelIDs) *model.AppError); ok {
r1 = rf(patch)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// RemoveChannelsFromPolicy provides a mock function with given fields: policyID, channelIDs
func (_m *DataRetentionInterface) RemoveChannelsFromPolicy(policyID string, channelIDs []string) *model.AppError {
ret := _m.Called(policyID, channelIDs)
if len(ret) == 0 {
panic("no return value specified for RemoveChannelsFromPolicy")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, []string) *model.AppError); ok {
r0 = rf(policyID, channelIDs)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// RemoveTeamsFromPolicy provides a mock function with given fields: policyID, teamIDs
func (_m *DataRetentionInterface) RemoveTeamsFromPolicy(policyID string, teamIDs []string) *model.AppError {
ret := _m.Called(policyID, teamIDs)
if len(ret) == 0 {
panic("no return value specified for RemoveTeamsFromPolicy")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, []string) *model.AppError); ok {
r0 = rf(policyID, teamIDs)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// NewDataRetentionInterface creates a new instance of DataRetentionInterface. 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 NewDataRetentionInterface(t interface {
mock.TestingT
Cleanup(func())
}) *DataRetentionInterface {
mock := &DataRetentionInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,70 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
jobs "github.com/mattermost/mattermost/server/v8/einterfaces/jobs"
mock "github.com/stretchr/testify/mock"
)
// DataRetentionJobInterface is an autogenerated mock type for the DataRetentionJobInterface type
type DataRetentionJobInterface struct {
mock.Mock
}
// MakeScheduler provides a mock function with no fields
func (_m *DataRetentionJobInterface) MakeScheduler() jobs.Scheduler {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeScheduler")
}
var r0 jobs.Scheduler
if rf, ok := ret.Get(0).(func() jobs.Scheduler); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(jobs.Scheduler)
}
}
return r0
}
// MakeWorker provides a mock function with no fields
func (_m *DataRetentionJobInterface) MakeWorker() model.Worker {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeWorker")
}
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
// NewDataRetentionJobInterface creates a new instance of DataRetentionJobInterface. 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 NewDataRetentionJobInterface(t interface {
mock.TestingT
Cleanup(func())
}) *DataRetentionJobInterface {
mock := &DataRetentionJobInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,70 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
jobs "github.com/mattermost/mattermost/server/v8/einterfaces/jobs"
mock "github.com/stretchr/testify/mock"
)
// ElasticsearchAggregatorInterface is an autogenerated mock type for the ElasticsearchAggregatorInterface type
type ElasticsearchAggregatorInterface struct {
mock.Mock
}
// MakeScheduler provides a mock function with no fields
func (_m *ElasticsearchAggregatorInterface) MakeScheduler() jobs.Scheduler {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeScheduler")
}
var r0 jobs.Scheduler
if rf, ok := ret.Get(0).(func() jobs.Scheduler); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(jobs.Scheduler)
}
}
return r0
}
// MakeWorker provides a mock function with no fields
func (_m *ElasticsearchAggregatorInterface) MakeWorker() model.Worker {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeWorker")
}
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
// NewElasticsearchAggregatorInterface creates a new instance of ElasticsearchAggregatorInterface. 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 NewElasticsearchAggregatorInterface(t interface {
mock.TestingT
Cleanup(func())
}) *ElasticsearchAggregatorInterface {
mock := &ElasticsearchAggregatorInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,46 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// ElasticsearchFixChannelIndexInterface is an autogenerated mock type for the ElasticsearchFixChannelIndexInterface type
type ElasticsearchFixChannelIndexInterface struct {
mock.Mock
}
// MakeWorker provides a mock function with given fields:
func (_m *ElasticsearchFixChannelIndexInterface) MakeWorker() model.Worker {
ret := _m.Called()
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
type mockConstructorTestingTNewElasticsearchFixChannelIndexInterface interface {
mock.TestingT
Cleanup(func())
}
// NewElasticsearchFixChannelIndexInterface creates a new instance of ElasticsearchFixChannelIndexInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewElasticsearchFixChannelIndexInterface(t mockConstructorTestingTNewElasticsearchFixChannelIndexInterface) *ElasticsearchFixChannelIndexInterface {
mock := &ElasticsearchFixChannelIndexInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,49 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// ElasticsearchIndexerInterface is an autogenerated mock type for the ElasticsearchIndexerInterface type
type ElasticsearchIndexerInterface struct {
mock.Mock
}
// MakeWorker provides a mock function with no fields
func (_m *ElasticsearchIndexerInterface) MakeWorker() model.Worker {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeWorker")
}
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
// NewElasticsearchIndexerInterface creates a new instance of ElasticsearchIndexerInterface. 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 NewElasticsearchIndexerInterface(t interface {
mock.TestingT
Cleanup(func())
}) *ElasticsearchIndexerInterface {
mock := &ElasticsearchIndexerInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,89 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// IPFilteringInterface is an autogenerated mock type for the IPFilteringInterface type
type IPFilteringInterface struct {
mock.Mock
}
// ApplyIPFilters provides a mock function with given fields: allowedIPRanges
func (_m *IPFilteringInterface) ApplyIPFilters(allowedIPRanges *model.AllowedIPRanges) (*model.AllowedIPRanges, error) {
ret := _m.Called(allowedIPRanges)
if len(ret) == 0 {
panic("no return value specified for ApplyIPFilters")
}
var r0 *model.AllowedIPRanges
var r1 error
if rf, ok := ret.Get(0).(func(*model.AllowedIPRanges) (*model.AllowedIPRanges, error)); ok {
return rf(allowedIPRanges)
}
if rf, ok := ret.Get(0).(func(*model.AllowedIPRanges) *model.AllowedIPRanges); ok {
r0 = rf(allowedIPRanges)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AllowedIPRanges)
}
}
if rf, ok := ret.Get(1).(func(*model.AllowedIPRanges) error); ok {
r1 = rf(allowedIPRanges)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetIPFilters provides a mock function with no fields
func (_m *IPFilteringInterface) GetIPFilters() (*model.AllowedIPRanges, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetIPFilters")
}
var r0 *model.AllowedIPRanges
var r1 error
if rf, ok := ret.Get(0).(func() (*model.AllowedIPRanges, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() *model.AllowedIPRanges); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AllowedIPRanges)
}
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewIPFilteringInterface creates a new instance of IPFilteringInterface. 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 NewIPFilteringInterface(t interface {
mock.TestingT
Cleanup(func())
}) *IPFilteringInterface {
mock := &IPFilteringInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,49 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// IndexerJobInterface is an autogenerated mock type for the IndexerJobInterface type
type IndexerJobInterface struct {
mock.Mock
}
// MakeWorker provides a mock function with no fields
func (_m *IndexerJobInterface) MakeWorker() model.Worker {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeWorker")
}
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
// NewIndexerJobInterface creates a new instance of IndexerJobInterface. 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 NewIndexerJobInterface(t interface {
mock.TestingT
Cleanup(func())
}) *IndexerJobInterface {
mock := &IndexerJobInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,80 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
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"
)
// IntuneInterface is an autogenerated mock type for the IntuneInterface type
type IntuneInterface struct {
mock.Mock
}
// IsConfigured provides a mock function with no fields
func (_m *IntuneInterface) IsConfigured() bool {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for IsConfigured")
}
var r0 bool
if rf, ok := ret.Get(0).(func() bool); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// Login provides a mock function with given fields: rctx, accessToken
func (_m *IntuneInterface) Login(rctx request.CTX, accessToken string) (*model.User, *model.AppError) {
ret := _m.Called(rctx, accessToken)
if len(ret) == 0 {
panic("no return value specified for Login")
}
var r0 *model.User
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) (*model.User, *model.AppError)); ok {
return rf(rctx, accessToken)
}
if rf, ok := ret.Get(0).(func(request.CTX, string) *model.User); ok {
r0 = rf(rctx, accessToken)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.User)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, accessToken)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// NewIntuneInterface creates a new instance of IntuneInterface. 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 NewIntuneInterface(t interface {
mock.TestingT
Cleanup(func())
}) *IntuneInterface {
mock := &IntuneInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,137 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
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"
)
// LdapDiagnosticInterface is an autogenerated mock type for the LdapDiagnosticInterface type
type LdapDiagnosticInterface struct {
mock.Mock
}
// GetVendorNameAndVendorVersion provides a mock function with given fields: rctx
func (_m *LdapDiagnosticInterface) GetVendorNameAndVendorVersion(rctx request.CTX) (string, string, error) {
ret := _m.Called(rctx)
if len(ret) == 0 {
panic("no return value specified for GetVendorNameAndVendorVersion")
}
var r0 string
var r1 string
var r2 error
if rf, ok := ret.Get(0).(func(request.CTX) (string, string, error)); ok {
return rf(rctx)
}
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(request.CTX) string); ok {
r1 = rf(rctx)
} else {
r1 = ret.Get(1).(string)
}
if rf, ok := ret.Get(2).(func(request.CTX) error); ok {
r2 = rf(rctx)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// RunTest provides a mock function with given fields: rctx
func (_m *LdapDiagnosticInterface) RunTest(rctx request.CTX) *model.AppError {
ret := _m.Called(rctx)
if len(ret) == 0 {
panic("no return value specified for RunTest")
}
var r0 *model.AppError
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)
}
}
return r0
}
// RunTestConnection provides a mock function with given fields: rctx, settings
func (_m *LdapDiagnosticInterface) RunTestConnection(rctx request.CTX, settings model.LdapSettings) *model.AppError {
ret := _m.Called(rctx, settings)
if len(ret) == 0 {
panic("no return value specified for RunTestConnection")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, model.LdapSettings) *model.AppError); ok {
r0 = rf(rctx, settings)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// RunTestDiagnostics provides a mock function with given fields: rctx, testType, settings
func (_m *LdapDiagnosticInterface) RunTestDiagnostics(rctx request.CTX, testType model.LdapDiagnosticTestType, settings model.LdapSettings) ([]model.LdapDiagnosticResult, *model.AppError) {
ret := _m.Called(rctx, testType, settings)
if len(ret) == 0 {
panic("no return value specified for RunTestDiagnostics")
}
var r0 []model.LdapDiagnosticResult
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, model.LdapDiagnosticTestType, model.LdapSettings) ([]model.LdapDiagnosticResult, *model.AppError)); ok {
return rf(rctx, testType, settings)
}
if rf, ok := ret.Get(0).(func(request.CTX, model.LdapDiagnosticTestType, model.LdapSettings) []model.LdapDiagnosticResult); ok {
r0 = rf(rctx, testType, settings)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]model.LdapDiagnosticResult)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, model.LdapDiagnosticTestType, model.LdapSettings) *model.AppError); ok {
r1 = rf(rctx, testType, settings)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// NewLdapDiagnosticInterface creates a new instance of LdapDiagnosticInterface. 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 NewLdapDiagnosticInterface(t interface {
mock.TestingT
Cleanup(func())
}) *LdapDiagnosticInterface {
mock := &LdapDiagnosticInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,381 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
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"
)
// LdapInterface is an autogenerated mock type for the LdapInterface type
type LdapInterface struct {
mock.Mock
}
// CheckProviderAttributes provides a mock function with given fields: rctx, LS, ouser, patch
func (_m *LdapInterface) CheckProviderAttributes(rctx request.CTX, LS *model.LdapSettings, ouser *model.User, patch *model.UserPatch) string {
ret := _m.Called(rctx, LS, ouser, patch)
if len(ret) == 0 {
panic("no return value specified for CheckProviderAttributes")
}
var r0 string
if rf, ok := ret.Get(0).(func(request.CTX, *model.LdapSettings, *model.User, *model.UserPatch) string); ok {
r0 = rf(rctx, LS, ouser, patch)
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// DoLogin provides a mock function with given fields: rctx, id, password
func (_m *LdapInterface) DoLogin(rctx request.CTX, id string, password string) (*model.User, *model.AppError) {
ret := _m.Called(rctx, id, password)
if len(ret) == 0 {
panic("no return value specified for DoLogin")
}
var r0 *model.User
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, string) (*model.User, *model.AppError)); ok {
return rf(rctx, id, password)
}
if rf, ok := ret.Get(0).(func(request.CTX, string, string) *model.User); ok {
r0 = rf(rctx, id, password)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.User)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string, string) *model.AppError); ok {
r1 = rf(rctx, id, password)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// FirstLoginSync provides a mock function with given fields: rctx, user
func (_m *LdapInterface) FirstLoginSync(rctx request.CTX, user *model.User) *model.AppError {
ret := _m.Called(rctx, user)
if len(ret) == 0 {
panic("no return value specified for FirstLoginSync")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, *model.User) *model.AppError); ok {
r0 = rf(rctx, user)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// 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)
if len(ret) == 0 {
panic("no return value specified for GetAllGroupsPage")
}
var r0 []*model.Group
var r1 int
var r2 *model.AppError
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(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(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(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)
}
}
return r0, r1, r2
}
// GetAllLdapUsers provides a mock function with given fields: rctx
func (_m *LdapInterface) GetAllLdapUsers(rctx request.CTX) ([]*model.User, *model.AppError) {
ret := _m.Called(rctx)
if len(ret) == 0 {
panic("no return value specified for GetAllLdapUsers")
}
var r0 []*model.User
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX) ([]*model.User, *model.AppError)); ok {
return rf(rctx)
}
if rf, ok := ret.Get(0).(func(request.CTX) []*model.User); ok {
r0 = rf(rctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.User)
}
}
if rf, ok := ret.Get(1).(func(request.CTX) *model.AppError); ok {
r1 = rf(rctx)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// 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)
if len(ret) == 0 {
panic("no return value specified for GetGroup")
}
var r0 *model.Group
var r1 *model.AppError
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(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(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, groupUID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetLDAPUserForMMUser provides a mock function with given fields: rctx, mmUser
func (_m *LdapInterface) GetLDAPUserForMMUser(rctx request.CTX, mmUser *model.User) (*model.User, string, *model.AppError) {
ret := _m.Called(rctx, mmUser)
if len(ret) == 0 {
panic("no return value specified for GetLDAPUserForMMUser")
}
var r0 *model.User
var r1 string
var r2 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, *model.User) (*model.User, string, *model.AppError)); ok {
return rf(rctx, mmUser)
}
if rf, ok := ret.Get(0).(func(request.CTX, *model.User) *model.User); ok {
r0 = rf(rctx, mmUser)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.User)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, *model.User) string); ok {
r1 = rf(rctx, mmUser)
} else {
r1 = ret.Get(1).(string)
}
if rf, ok := ret.Get(2).(func(request.CTX, *model.User) *model.AppError); ok {
r2 = rf(rctx, mmUser)
} else {
if ret.Get(2) != nil {
r2 = ret.Get(2).(*model.AppError)
}
}
return r0, r1, r2
}
// GetUser provides a mock function with given fields: rctx, id
func (_m *LdapInterface) GetUser(rctx request.CTX, id string) (*model.User, *model.AppError) {
ret := _m.Called(rctx, id)
if len(ret) == 0 {
panic("no return value specified for GetUser")
}
var r0 *model.User
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) (*model.User, *model.AppError)); ok {
return rf(rctx, id)
}
if rf, ok := ret.Get(0).(func(request.CTX, string) *model.User); ok {
r0 = rf(rctx, id)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.User)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, id)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// 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)
if len(ret) == 0 {
panic("no return value specified for GetUserAttributes")
}
var r0 map[string]string
var r1 *model.AppError
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(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(request.CTX, string, []string) *model.AppError); ok {
r1 = rf(rctx, id, attributes)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// MigrateIDAttribute provides a mock function with given fields: rctx, toAttribute
func (_m *LdapInterface) MigrateIDAttribute(rctx request.CTX, toAttribute string) error {
ret := _m.Called(rctx, toAttribute)
if len(ret) == 0 {
panic("no return value specified for MigrateIDAttribute")
}
var r0 error
if rf, ok := ret.Get(0).(func(request.CTX, string) error); ok {
r0 = rf(rctx, toAttribute)
} else {
r0 = ret.Error(0)
}
return r0
}
// StartSynchronizeJob provides a mock function with given fields: rctx, waitForJobToFinish
func (_m *LdapInterface) StartSynchronizeJob(rctx request.CTX, waitForJobToFinish bool) (*model.Job, *model.AppError) {
ret := _m.Called(rctx, waitForJobToFinish)
if len(ret) == 0 {
panic("no return value specified for StartSynchronizeJob")
}
var r0 *model.Job
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, bool) (*model.Job, *model.AppError)); ok {
return rf(rctx, waitForJobToFinish)
}
if rf, ok := ret.Get(0).(func(request.CTX, bool) *model.Job); ok {
r0 = rf(rctx, waitForJobToFinish)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Job)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, bool) *model.AppError); ok {
r1 = rf(rctx, waitForJobToFinish)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// SwitchToLdap provides a mock function with given fields: rctx, userID, ldapID, ldapPassword
func (_m *LdapInterface) SwitchToLdap(rctx request.CTX, userID string, ldapID string, ldapPassword string) *model.AppError {
ret := _m.Called(rctx, userID, ldapID, ldapPassword)
if len(ret) == 0 {
panic("no return value specified for SwitchToLdap")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, string, string) *model.AppError); ok {
r0 = rf(rctx, userID, ldapID, ldapPassword)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// UpdateProfilePictureIfNecessary provides a mock function with given fields: _a0, _a1, _a2
func (_m *LdapInterface) UpdateProfilePictureIfNecessary(_a0 request.CTX, _a1 model.User, _a2 model.Session) {
_m.Called(_a0, _a1, _a2)
}
// NewLdapInterface creates a new instance of LdapInterface. 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 NewLdapInterface(t interface {
mock.TestingT
Cleanup(func())
}) *LdapInterface {
mock := &LdapInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,70 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
jobs "github.com/mattermost/mattermost/server/v8/einterfaces/jobs"
mock "github.com/stretchr/testify/mock"
)
// LdapSyncInterface is an autogenerated mock type for the LdapSyncInterface type
type LdapSyncInterface struct {
mock.Mock
}
// MakeScheduler provides a mock function with no fields
func (_m *LdapSyncInterface) MakeScheduler() jobs.Scheduler {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeScheduler")
}
var r0 jobs.Scheduler
if rf, ok := ret.Get(0).(func() jobs.Scheduler); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(jobs.Scheduler)
}
}
return r0
}
// MakeWorker provides a mock function with no fields
func (_m *LdapSyncInterface) MakeWorker() model.Worker {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeWorker")
}
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
// NewLdapSyncInterface creates a new instance of LdapSyncInterface. 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 NewLdapSyncInterface(t interface {
mock.TestingT
Cleanup(func())
}) *LdapSyncInterface {
mock := &LdapSyncInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,107 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// LicenseInterface is an autogenerated mock type for the LicenseInterface type
type LicenseInterface struct {
mock.Mock
}
// CanStartTrial provides a mock function with no fields
func (_m *LicenseInterface) CanStartTrial() (bool, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for CanStartTrial")
}
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func() (bool, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() bool); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetPrevTrial provides a mock function with no fields
func (_m *LicenseInterface) GetPrevTrial() (*model.License, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetPrevTrial")
}
var r0 *model.License
var r1 error
if rf, ok := ret.Get(0).(func() (*model.License, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() *model.License); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.License)
}
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewMattermostEntryLicense provides a mock function with given fields: serverId
func (_m *LicenseInterface) NewMattermostEntryLicense(serverId string) *model.License {
ret := _m.Called(serverId)
if len(ret) == 0 {
panic("no return value specified for NewMattermostEntryLicense")
}
var r0 *model.License
if rf, ok := ret.Get(0).(func(string) *model.License); ok {
r0 = rf(serverId)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.License)
}
}
return r0
}
// NewLicenseInterface creates a new instance of LicenseInterface. 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 NewLicenseInterface(t interface {
mock.TestingT
Cleanup(func())
}) *LicenseInterface {
mock := &LicenseInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,62 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
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"
)
// MessageExportInterface is an autogenerated mock type for the MessageExportInterface type
type MessageExportInterface struct {
mock.Mock
}
// StartSynchronizeJob provides a mock function with given fields: rctx, exportFromTimestamp
func (_m *MessageExportInterface) StartSynchronizeJob(rctx request.CTX, exportFromTimestamp int64) (*model.Job, *model.AppError) {
ret := _m.Called(rctx, exportFromTimestamp)
if len(ret) == 0 {
panic("no return value specified for StartSynchronizeJob")
}
var r0 *model.Job
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, int64) (*model.Job, *model.AppError)); ok {
return rf(rctx, exportFromTimestamp)
}
if rf, ok := ret.Get(0).(func(request.CTX, int64) *model.Job); ok {
r0 = rf(rctx, exportFromTimestamp)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Job)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, int64) *model.AppError); ok {
r1 = rf(rctx, exportFromTimestamp)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// NewMessageExportInterface creates a new instance of MessageExportInterface. 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 NewMessageExportInterface(t interface {
mock.TestingT
Cleanup(func())
}) *MessageExportInterface {
mock := &MessageExportInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,70 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
jobs "github.com/mattermost/mattermost/server/v8/einterfaces/jobs"
mock "github.com/stretchr/testify/mock"
)
// MessageExportJobInterface is an autogenerated mock type for the MessageExportJobInterface type
type MessageExportJobInterface struct {
mock.Mock
}
// MakeScheduler provides a mock function with no fields
func (_m *MessageExportJobInterface) MakeScheduler() jobs.Scheduler {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeScheduler")
}
var r0 jobs.Scheduler
if rf, ok := ret.Get(0).(func() jobs.Scheduler); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(jobs.Scheduler)
}
}
return r0
}
// MakeWorker provides a mock function with no fields
func (_m *MessageExportJobInterface) MakeWorker() model.Worker {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeWorker")
}
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
// NewMessageExportJobInterface creates a new instance of MessageExportJobInterface. 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 NewMessageExportJobInterface(t interface {
mock.TestingT
Cleanup(func())
}) *MessageExportJobInterface {
mock := &MessageExportJobInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,637 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
sql "database/sql"
logr "github.com/mattermost/logr/v2"
model "github.com/mattermost/mattermost/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// MetricsInterface is an autogenerated mock type for the MetricsInterface type
type MetricsInterface struct {
mock.Mock
}
// AddAutoTranslateRecoveryStuckFound provides a mock function with given fields: count
func (_m *MetricsInterface) AddAutoTranslateRecoveryStuckFound(count float64) {
_m.Called(count)
}
// AddMemCacheHitCounter provides a mock function with given fields: cacheName, amount
func (_m *MetricsInterface) AddMemCacheHitCounter(cacheName string, amount float64) {
_m.Called(cacheName, amount)
}
// AddMemCacheMissCounter provides a mock function with given fields: cacheName, amount
func (_m *MetricsInterface) AddMemCacheMissCounter(cacheName string, amount float64) {
_m.Called(cacheName, amount)
}
// ClearMobileClientSessionMetadata provides a mock function with no fields
func (_m *MetricsInterface) ClearMobileClientSessionMetadata() {
_m.Called()
}
// DecrementHTTPWebSockets provides a mock function with given fields: originClient
func (_m *MetricsInterface) DecrementHTTPWebSockets(originClient string) {
_m.Called(originClient)
}
// DecrementJobActive provides a mock function with given fields: jobType
func (_m *MetricsInterface) DecrementJobActive(jobType string) {
_m.Called(jobType)
}
// DecrementWebSocketBroadcastBufferSize provides a mock function with given fields: hub, amount
func (_m *MetricsInterface) DecrementWebSocketBroadcastBufferSize(hub string, amount float64) {
_m.Called(hub, amount)
}
// DecrementWebSocketBroadcastUsersRegistered provides a mock function with given fields: hub, amount
func (_m *MetricsInterface) DecrementWebSocketBroadcastUsersRegistered(hub string, amount float64) {
_m.Called(hub, amount)
}
// GetLoggerMetricsCollector provides a mock function with no fields
func (_m *MetricsInterface) GetLoggerMetricsCollector() logr.MetricsCollector {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetLoggerMetricsCollector")
}
var r0 logr.MetricsCollector
if rf, ok := ret.Get(0).(func() logr.MetricsCollector); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(logr.MetricsCollector)
}
}
return r0
}
// IncrementAccessControlCacheInvalidation provides a mock function with no fields
func (_m *MetricsInterface) IncrementAccessControlCacheInvalidation() {
_m.Called()
}
// IncrementAutoTranslateNormHash provides a mock function with given fields: result
func (_m *MetricsInterface) IncrementAutoTranslateNormHash(result string) {
_m.Called(result)
}
// IncrementChannelIndexCounter provides a mock function with no fields
func (_m *MetricsInterface) IncrementChannelIndexCounter() {
_m.Called()
}
// IncrementClientLongTasks provides a mock function with given fields: platform, agent, userID, inc
func (_m *MetricsInterface) IncrementClientLongTasks(platform string, agent string, userID string, inc float64) {
_m.Called(platform, agent, userID, inc)
}
// IncrementClusterEventType provides a mock function with given fields: eventType
func (_m *MetricsInterface) IncrementClusterEventType(eventType model.ClusterEvent) {
_m.Called(eventType)
}
// IncrementClusterRequest provides a mock function with no fields
func (_m *MetricsInterface) IncrementClusterRequest() {
_m.Called()
}
// IncrementEtagHitCounter provides a mock function with given fields: route
func (_m *MetricsInterface) IncrementEtagHitCounter(route string) {
_m.Called(route)
}
// IncrementEtagMissCounter provides a mock function with given fields: route
func (_m *MetricsInterface) IncrementEtagMissCounter(route string) {
_m.Called(route)
}
// IncrementFileIndexCounter provides a mock function with no fields
func (_m *MetricsInterface) IncrementFileIndexCounter() {
_m.Called()
}
// IncrementFilesSearchCounter provides a mock function with no fields
func (_m *MetricsInterface) IncrementFilesSearchCounter() {
_m.Called()
}
// IncrementHTTPError provides a mock function with no fields
func (_m *MetricsInterface) IncrementHTTPError() {
_m.Called()
}
// IncrementHTTPRequest provides a mock function with no fields
func (_m *MetricsInterface) IncrementHTTPRequest() {
_m.Called()
}
// IncrementHTTPWebSockets provides a mock function with given fields: originClient
func (_m *MetricsInterface) IncrementHTTPWebSockets(originClient string) {
_m.Called(originClient)
}
// IncrementJobActive provides a mock function with given fields: jobType
func (_m *MetricsInterface) IncrementJobActive(jobType string) {
_m.Called(jobType)
}
// IncrementLogin provides a mock function with no fields
func (_m *MetricsInterface) IncrementLogin() {
_m.Called()
}
// IncrementLoginFail provides a mock function with no fields
func (_m *MetricsInterface) IncrementLoginFail() {
_m.Called()
}
// IncrementMemCacheHitCounter provides a mock function with given fields: cacheName
func (_m *MetricsInterface) IncrementMemCacheHitCounter(cacheName string) {
_m.Called(cacheName)
}
// IncrementMemCacheHitCounterSession provides a mock function with no fields
func (_m *MetricsInterface) IncrementMemCacheHitCounterSession() {
_m.Called()
}
// IncrementMemCacheInvalidationCounter provides a mock function with given fields: cacheName
func (_m *MetricsInterface) IncrementMemCacheInvalidationCounter(cacheName string) {
_m.Called(cacheName)
}
// IncrementMemCacheInvalidationCounterSession provides a mock function with no fields
func (_m *MetricsInterface) IncrementMemCacheInvalidationCounterSession() {
_m.Called()
}
// IncrementMemCacheMissCounter provides a mock function with given fields: cacheName
func (_m *MetricsInterface) IncrementMemCacheMissCounter(cacheName string) {
_m.Called(cacheName)
}
// IncrementMemCacheMissCounterSession provides a mock function with no fields
func (_m *MetricsInterface) IncrementMemCacheMissCounterSession() {
_m.Called()
}
// IncrementNotificationAckCounter provides a mock function with given fields: notificationType, platform
func (_m *MetricsInterface) IncrementNotificationAckCounter(notificationType model.NotificationType, platform string) {
_m.Called(notificationType, platform)
}
// IncrementNotificationCounter provides a mock function with given fields: notificationType, platform
func (_m *MetricsInterface) IncrementNotificationCounter(notificationType model.NotificationType, platform string) {
_m.Called(notificationType, platform)
}
// IncrementNotificationErrorCounter provides a mock function with given fields: notificationType, errorReason, platform
func (_m *MetricsInterface) IncrementNotificationErrorCounter(notificationType model.NotificationType, errorReason model.NotificationReason, platform string) {
_m.Called(notificationType, errorReason, platform)
}
// IncrementNotificationNotSentCounter provides a mock function with given fields: notificationType, notSentReason, platform
func (_m *MetricsInterface) IncrementNotificationNotSentCounter(notificationType model.NotificationType, notSentReason model.NotificationReason, platform string) {
_m.Called(notificationType, notSentReason, platform)
}
// IncrementNotificationSuccessCounter provides a mock function with given fields: notificationType, platform
func (_m *MetricsInterface) IncrementNotificationSuccessCounter(notificationType model.NotificationType, platform string) {
_m.Called(notificationType, platform)
}
// IncrementNotificationUnsupportedCounter provides a mock function with given fields: notificationType, notSentReason, platform
func (_m *MetricsInterface) IncrementNotificationUnsupportedCounter(notificationType model.NotificationType, notSentReason model.NotificationReason, platform string) {
_m.Called(notificationType, notSentReason, platform)
}
// IncrementPostBroadcast provides a mock function with no fields
func (_m *MetricsInterface) IncrementPostBroadcast() {
_m.Called()
}
// IncrementPostCreate provides a mock function with no fields
func (_m *MetricsInterface) IncrementPostCreate() {
_m.Called()
}
// IncrementPostFileAttachment provides a mock function with given fields: count
func (_m *MetricsInterface) IncrementPostFileAttachment(count int) {
_m.Called(count)
}
// IncrementPostIndexCounter provides a mock function with no fields
func (_m *MetricsInterface) IncrementPostIndexCounter() {
_m.Called()
}
// IncrementPostSentEmail provides a mock function with no fields
func (_m *MetricsInterface) IncrementPostSentEmail() {
_m.Called()
}
// IncrementPostSentPush provides a mock function with no fields
func (_m *MetricsInterface) IncrementPostSentPush() {
_m.Called()
}
// IncrementPostsSearchCounter provides a mock function with no fields
func (_m *MetricsInterface) IncrementPostsSearchCounter() {
_m.Called()
}
// IncrementRemoteClusterConnStateChangeCounter provides a mock function with given fields: remoteID, online
func (_m *MetricsInterface) IncrementRemoteClusterConnStateChangeCounter(remoteID string, online bool) {
_m.Called(remoteID, online)
}
// IncrementRemoteClusterMsgErrorsCounter provides a mock function with given fields: remoteID, timeout
func (_m *MetricsInterface) IncrementRemoteClusterMsgErrorsCounter(remoteID string, timeout bool) {
_m.Called(remoteID, timeout)
}
// IncrementRemoteClusterMsgReceivedCounter provides a mock function with given fields: remoteID
func (_m *MetricsInterface) IncrementRemoteClusterMsgReceivedCounter(remoteID string) {
_m.Called(remoteID)
}
// IncrementRemoteClusterMsgSentCounter provides a mock function with given fields: remoteID
func (_m *MetricsInterface) IncrementRemoteClusterMsgSentCounter(remoteID string) {
_m.Called(remoteID)
}
// IncrementSharedChannelsSyncCounter provides a mock function with given fields: remoteID
func (_m *MetricsInterface) IncrementSharedChannelsSyncCounter(remoteID string) {
_m.Called(remoteID)
}
// IncrementUserIndexCounter provides a mock function with no fields
func (_m *MetricsInterface) IncrementUserIndexCounter() {
_m.Called()
}
// IncrementWebSocketBroadcast provides a mock function with given fields: eventType
func (_m *MetricsInterface) IncrementWebSocketBroadcast(eventType model.WebsocketEventType) {
_m.Called(eventType)
}
// IncrementWebSocketBroadcastBufferSize provides a mock function with given fields: hub, amount
func (_m *MetricsInterface) IncrementWebSocketBroadcastBufferSize(hub string, amount float64) {
_m.Called(hub, amount)
}
// IncrementWebSocketBroadcastUsersRegistered provides a mock function with given fields: hub, amount
func (_m *MetricsInterface) IncrementWebSocketBroadcastUsersRegistered(hub string, amount float64) {
_m.Called(hub, amount)
}
// IncrementWebhookPost provides a mock function with no fields
func (_m *MetricsInterface) IncrementWebhookPost() {
_m.Called()
}
// IncrementWebsocketEvent provides a mock function with given fields: eventType
func (_m *MetricsInterface) IncrementWebsocketEvent(eventType model.WebsocketEventType) {
_m.Called(eventType)
}
// IncrementWebsocketReconnectEventWithDisconnectErrCode provides a mock function with given fields: eventType, disconnectErrCode
func (_m *MetricsInterface) IncrementWebsocketReconnectEventWithDisconnectErrCode(eventType string, disconnectErrCode string) {
_m.Called(eventType, disconnectErrCode)
}
// ObserveAPIEndpointDuration provides a mock function with given fields: endpoint, method, statusCode, originClient, pageLoadContext, elapsed
func (_m *MetricsInterface) ObserveAPIEndpointDuration(endpoint string, method string, statusCode string, originClient string, pageLoadContext string, elapsed float64) {
_m.Called(endpoint, method, statusCode, originClient, pageLoadContext, elapsed)
}
// ObserveAccessControlEvaluateDuration provides a mock function with given fields: value
func (_m *MetricsInterface) ObserveAccessControlEvaluateDuration(value float64) {
_m.Called(value)
}
// ObserveAccessControlExpressionCompileDuration provides a mock function with given fields: value
func (_m *MetricsInterface) ObserveAccessControlExpressionCompileDuration(value float64) {
_m.Called(value)
}
// ObserveAccessControlSearchQueryDuration provides a mock function with given fields: value
func (_m *MetricsInterface) ObserveAccessControlSearchQueryDuration(value float64) {
_m.Called(value)
}
// ObserveAutoTranslateLinguaDetectionDuration provides a mock function with given fields: elapsed
func (_m *MetricsInterface) ObserveAutoTranslateLinguaDetectionDuration(elapsed float64) {
_m.Called(elapsed)
}
// ObserveAutoTranslateProviderCallDuration provides a mock function with given fields: provider, result, elapsed
func (_m *MetricsInterface) ObserveAutoTranslateProviderCallDuration(provider string, result string, elapsed float64) {
_m.Called(provider, result, elapsed)
}
// ObserveAutoTranslateTranslateDuration provides a mock function with given fields: objectType, elapsed
func (_m *MetricsInterface) ObserveAutoTranslateTranslateDuration(objectType string, elapsed float64) {
_m.Called(objectType, elapsed)
}
// ObserveAutoTranslateWorkerTaskDuration provides a mock function with given fields: elapsed
func (_m *MetricsInterface) ObserveAutoTranslateWorkerTaskDuration(elapsed float64) {
_m.Called(elapsed)
}
// ObserveClientChannelSwitchDuration provides a mock function with given fields: platform, agent, fresh, userID, elapsed
func (_m *MetricsInterface) ObserveClientChannelSwitchDuration(platform string, agent string, fresh string, userID string, elapsed float64) {
_m.Called(platform, agent, fresh, userID, elapsed)
}
// ObserveClientCumulativeLayoutShift provides a mock function with given fields: platform, agent, userID, elapsed
func (_m *MetricsInterface) ObserveClientCumulativeLayoutShift(platform string, agent string, userID string, elapsed float64) {
_m.Called(platform, agent, userID, elapsed)
}
// ObserveClientFirstContentfulPaint provides a mock function with given fields: platform, agent, userID, elapsed
func (_m *MetricsInterface) ObserveClientFirstContentfulPaint(platform string, agent string, userID string, elapsed float64) {
_m.Called(platform, agent, userID, elapsed)
}
// ObserveClientInteractionToNextPaint provides a mock function with given fields: platform, agent, interaction, userID, elapsed
func (_m *MetricsInterface) ObserveClientInteractionToNextPaint(platform string, agent string, interaction string, userID string, elapsed float64) {
_m.Called(platform, agent, interaction, userID, elapsed)
}
// ObserveClientLargestContentfulPaint provides a mock function with given fields: platform, agent, region, userID, elapsed
func (_m *MetricsInterface) ObserveClientLargestContentfulPaint(platform string, agent string, region string, userID string, elapsed float64) {
_m.Called(platform, agent, region, userID, elapsed)
}
// ObserveClientPageLoadDuration provides a mock function with given fields: platform, agent, userID, elapsed
func (_m *MetricsInterface) ObserveClientPageLoadDuration(platform string, agent string, userID string, elapsed float64) {
_m.Called(platform, agent, userID, elapsed)
}
// ObserveClientRHSLoadDuration provides a mock function with given fields: platform, agent, userID, elapsed
func (_m *MetricsInterface) ObserveClientRHSLoadDuration(platform string, agent string, userID string, elapsed float64) {
_m.Called(platform, agent, userID, elapsed)
}
// ObserveClientSplashScreenEnd provides a mock function with given fields: platform, agent, pageType, userID, elapsed
func (_m *MetricsInterface) ObserveClientSplashScreenEnd(platform string, agent string, pageType string, userID string, elapsed float64) {
_m.Called(platform, agent, pageType, userID, elapsed)
}
// ObserveClientTeamSwitchDuration provides a mock function with given fields: platform, agent, fresh, userID, elapsed
func (_m *MetricsInterface) ObserveClientTeamSwitchDuration(platform string, agent string, fresh string, userID string, elapsed float64) {
_m.Called(platform, agent, fresh, userID, elapsed)
}
// ObserveClientTimeToDomInteractive provides a mock function with given fields: platform, agent, userID, elapsed
func (_m *MetricsInterface) ObserveClientTimeToDomInteractive(platform string, agent string, userID string, elapsed float64) {
_m.Called(platform, agent, userID, elapsed)
}
// ObserveClientTimeToFirstByte provides a mock function with given fields: platform, agent, userID, elapsed
func (_m *MetricsInterface) ObserveClientTimeToFirstByte(platform string, agent string, userID string, elapsed float64) {
_m.Called(platform, agent, userID, elapsed)
}
// ObserveClientTimeToLastByte provides a mock function with given fields: platform, agent, userID, elapsed
func (_m *MetricsInterface) ObserveClientTimeToLastByte(platform string, agent string, userID string, elapsed float64) {
_m.Called(platform, agent, userID, elapsed)
}
// ObserveClusterReliableFallbackLength provides a mock function with given fields: event, length
func (_m *MetricsInterface) ObserveClusterReliableFallbackLength(event model.ClusterEvent, length int) {
_m.Called(event, length)
}
// ObserveClusterRequestDuration provides a mock function with given fields: elapsed
func (_m *MetricsInterface) ObserveClusterRequestDuration(elapsed float64) {
_m.Called(elapsed)
}
// ObserveDesktopCpuUsage provides a mock function with given fields: platform, version, process, usage
func (_m *MetricsInterface) ObserveDesktopCpuUsage(platform string, version string, process string, usage float64) {
_m.Called(platform, version, process, usage)
}
// ObserveDesktopMemoryUsage provides a mock function with given fields: platform, version, process, usage
func (_m *MetricsInterface) ObserveDesktopMemoryUsage(platform string, version string, process string, usage float64) {
_m.Called(platform, version, process, usage)
}
// ObserveEnabledUsers provides a mock function with given fields: users
func (_m *MetricsInterface) ObserveEnabledUsers(users int64) {
_m.Called(users)
}
// ObserveFilesSearchDuration provides a mock function with given fields: elapsed
func (_m *MetricsInterface) ObserveFilesSearchDuration(elapsed float64) {
_m.Called(elapsed)
}
// ObserveGlobalThreadsLoadDuration provides a mock function with given fields: platform, agent, userID, elapsed
func (_m *MetricsInterface) ObserveGlobalThreadsLoadDuration(platform string, agent string, userID string, elapsed float64) {
_m.Called(platform, agent, userID, elapsed)
}
// ObserveMobileClientChannelSwitchDuration provides a mock function with given fields: platform, elapsed
func (_m *MetricsInterface) ObserveMobileClientChannelSwitchDuration(platform string, elapsed float64) {
_m.Called(platform, elapsed)
}
// ObserveMobileClientLoadDuration provides a mock function with given fields: platform, elapsed
func (_m *MetricsInterface) ObserveMobileClientLoadDuration(platform string, elapsed float64) {
_m.Called(platform, elapsed)
}
// ObserveMobileClientNetworkRequestsAverageSpeed provides a mock function with given fields: platform, agent, networkRequestGroup, speed
func (_m *MetricsInterface) ObserveMobileClientNetworkRequestsAverageSpeed(platform string, agent string, networkRequestGroup string, speed float64) {
_m.Called(platform, agent, networkRequestGroup, speed)
}
// ObserveMobileClientNetworkRequestsEffectiveLatency provides a mock function with given fields: platform, agent, networkRequestGroup, latency
func (_m *MetricsInterface) ObserveMobileClientNetworkRequestsEffectiveLatency(platform string, agent string, networkRequestGroup string, latency float64) {
_m.Called(platform, agent, networkRequestGroup, latency)
}
// ObserveMobileClientNetworkRequestsElapsedTime provides a mock function with given fields: platform, agent, networkRequestGroup, elapsedTime
func (_m *MetricsInterface) ObserveMobileClientNetworkRequestsElapsedTime(platform string, agent string, networkRequestGroup string, elapsedTime float64) {
_m.Called(platform, agent, networkRequestGroup, elapsedTime)
}
// ObserveMobileClientNetworkRequestsLatency provides a mock function with given fields: platform, agent, networkRequestGroup, latency
func (_m *MetricsInterface) ObserveMobileClientNetworkRequestsLatency(platform string, agent string, networkRequestGroup string, latency float64) {
_m.Called(platform, agent, networkRequestGroup, latency)
}
// ObserveMobileClientNetworkRequestsTotalCompressedSize provides a mock function with given fields: platform, agent, networkRequestGroup, size
func (_m *MetricsInterface) ObserveMobileClientNetworkRequestsTotalCompressedSize(platform string, agent string, networkRequestGroup string, size float64) {
_m.Called(platform, agent, networkRequestGroup, size)
}
// ObserveMobileClientNetworkRequestsTotalParallelRequests provides a mock function with given fields: platform, agent, networkRequestGroup, count
func (_m *MetricsInterface) ObserveMobileClientNetworkRequestsTotalParallelRequests(platform string, agent string, networkRequestGroup string, count float64) {
_m.Called(platform, agent, networkRequestGroup, count)
}
// ObserveMobileClientNetworkRequestsTotalRequests provides a mock function with given fields: platform, agent, networkRequestGroup, count
func (_m *MetricsInterface) ObserveMobileClientNetworkRequestsTotalRequests(platform string, agent string, networkRequestGroup string, count float64) {
_m.Called(platform, agent, networkRequestGroup, count)
}
// ObserveMobileClientNetworkRequestsTotalSequentialRequests provides a mock function with given fields: platform, agent, networkRequestGroup, count
func (_m *MetricsInterface) ObserveMobileClientNetworkRequestsTotalSequentialRequests(platform string, agent string, networkRequestGroup string, count float64) {
_m.Called(platform, agent, networkRequestGroup, count)
}
// ObserveMobileClientNetworkRequestsTotalSize provides a mock function with given fields: platform, agent, networkRequestGroup, size
func (_m *MetricsInterface) ObserveMobileClientNetworkRequestsTotalSize(platform string, agent string, networkRequestGroup string, size float64) {
_m.Called(platform, agent, networkRequestGroup, size)
}
// ObserveMobileClientSessionMetadata provides a mock function with given fields: version, platform, value, notificationDisabled
func (_m *MetricsInterface) ObserveMobileClientSessionMetadata(version string, platform string, value float64, notificationDisabled string) {
_m.Called(version, platform, value, notificationDisabled)
}
// ObserveMobileClientTeamSwitchDuration provides a mock function with given fields: platform, elapsed
func (_m *MetricsInterface) ObserveMobileClientTeamSwitchDuration(platform string, elapsed float64) {
_m.Called(platform, elapsed)
}
// ObservePluginAPIDuration provides a mock function with given fields: pluginID, apiName, success, elapsed
func (_m *MetricsInterface) ObservePluginAPIDuration(pluginID string, apiName string, success bool, elapsed float64) {
_m.Called(pluginID, apiName, success, elapsed)
}
// ObservePluginHookDuration provides a mock function with given fields: pluginID, hookName, success, elapsed
func (_m *MetricsInterface) ObservePluginHookDuration(pluginID string, hookName string, success bool, elapsed float64) {
_m.Called(pluginID, hookName, success, elapsed)
}
// ObservePluginMultiHookDuration provides a mock function with given fields: elapsed
func (_m *MetricsInterface) ObservePluginMultiHookDuration(elapsed float64) {
_m.Called(elapsed)
}
// ObservePluginMultiHookIterationDuration provides a mock function with given fields: pluginID, elapsed
func (_m *MetricsInterface) ObservePluginMultiHookIterationDuration(pluginID string, elapsed float64) {
_m.Called(pluginID, elapsed)
}
// ObservePluginWebappPerf provides a mock function with given fields: platform, agent, pluginID, pluginMetricLabel, elapsed
func (_m *MetricsInterface) ObservePluginWebappPerf(platform string, agent string, pluginID string, pluginMetricLabel string, elapsed float64) {
_m.Called(platform, agent, pluginID, pluginMetricLabel, elapsed)
}
// ObservePostsSearchDuration provides a mock function with given fields: elapsed
func (_m *MetricsInterface) ObservePostsSearchDuration(elapsed float64) {
_m.Called(elapsed)
}
// ObserveRedisEndpointDuration provides a mock function with given fields: cacheName, operation, elapsed
func (_m *MetricsInterface) ObserveRedisEndpointDuration(cacheName string, operation string, elapsed float64) {
_m.Called(cacheName, operation, elapsed)
}
// ObserveRemoteClusterClockSkew provides a mock function with given fields: remoteID, skew
func (_m *MetricsInterface) ObserveRemoteClusterClockSkew(remoteID string, skew float64) {
_m.Called(remoteID, skew)
}
// ObserveRemoteClusterPingDuration provides a mock function with given fields: remoteID, elapsed
func (_m *MetricsInterface) ObserveRemoteClusterPingDuration(remoteID string, elapsed float64) {
_m.Called(remoteID, elapsed)
}
// ObserveSharedChannelsQueueSize provides a mock function with given fields: size
func (_m *MetricsInterface) ObserveSharedChannelsQueueSize(size int64) {
_m.Called(size)
}
// ObserveSharedChannelsSyncCollectionDuration provides a mock function with given fields: remoteID, elapsed
func (_m *MetricsInterface) ObserveSharedChannelsSyncCollectionDuration(remoteID string, elapsed float64) {
_m.Called(remoteID, elapsed)
}
// ObserveSharedChannelsSyncCollectionStepDuration provides a mock function with given fields: remoteID, step, elapsed
func (_m *MetricsInterface) ObserveSharedChannelsSyncCollectionStepDuration(remoteID string, step string, elapsed float64) {
_m.Called(remoteID, step, elapsed)
}
// ObserveSharedChannelsSyncSendDuration provides a mock function with given fields: remoteID, elapsed
func (_m *MetricsInterface) ObserveSharedChannelsSyncSendDuration(remoteID string, elapsed float64) {
_m.Called(remoteID, elapsed)
}
// ObserveSharedChannelsSyncSendStepDuration provides a mock function with given fields: remoteID, step, elapsed
func (_m *MetricsInterface) ObserveSharedChannelsSyncSendStepDuration(remoteID string, step string, elapsed float64) {
_m.Called(remoteID, step, elapsed)
}
// ObserveSharedChannelsTaskInQueueDuration provides a mock function with given fields: elapsed
func (_m *MetricsInterface) ObserveSharedChannelsTaskInQueueDuration(elapsed float64) {
_m.Called(elapsed)
}
// ObserveStoreMethodDuration provides a mock function with given fields: method, success, elapsed
func (_m *MetricsInterface) ObserveStoreMethodDuration(method string, success string, elapsed float64) {
_m.Called(method, success, elapsed)
}
// Register provides a mock function with no fields
func (_m *MetricsInterface) Register() {
_m.Called()
}
// RegisterDBCollector provides a mock function with given fields: db, name
func (_m *MetricsInterface) RegisterDBCollector(db *sql.DB, name string) {
_m.Called(db, name)
}
// SetAutoTranslateQueueDepth provides a mock function with given fields: depth
func (_m *MetricsInterface) SetAutoTranslateQueueDepth(depth float64) {
_m.Called(depth)
}
// SetReplicaLagAbsolute provides a mock function with given fields: node, value
func (_m *MetricsInterface) SetReplicaLagAbsolute(node string, value float64) {
_m.Called(node, value)
}
// SetReplicaLagTime provides a mock function with given fields: node, value
func (_m *MetricsInterface) SetReplicaLagTime(node string, value float64) {
_m.Called(node, value)
}
// UnregisterDBCollector provides a mock function with given fields: db, name
func (_m *MetricsInterface) UnregisterDBCollector(db *sql.DB, name string) {
_m.Called(db, name)
}
// NewMetricsInterface creates a new instance of MetricsInterface. 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 NewMetricsInterface(t interface {
mock.TestingT
Cleanup(func())
}) *MetricsInterface {
mock := &MetricsInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,123 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// MfaInterface is an autogenerated mock type for the MfaInterface type
type MfaInterface struct {
mock.Mock
}
// Activate provides a mock function with given fields: user, token
func (_m *MfaInterface) Activate(user *model.User, token string) *model.AppError {
ret := _m.Called(user, token)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(*model.User, string) *model.AppError); ok {
r0 = rf(user, token)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// Deactivate provides a mock function with given fields: userID
func (_m *MfaInterface) Deactivate(userID string) *model.AppError {
ret := _m.Called(userID)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string) *model.AppError); ok {
r0 = rf(userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// GenerateSecret provides a mock function with given fields: user
func (_m *MfaInterface) GenerateSecret(user *model.User) (string, []byte, *model.AppError) {
ret := _m.Called(user)
var r0 string
var r1 []byte
var r2 *model.AppError
if rf, ok := ret.Get(0).(func(*model.User) (string, []byte, *model.AppError)); ok {
return rf(user)
}
if rf, ok := ret.Get(0).(func(*model.User) string); ok {
r0 = rf(user)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(*model.User) []byte); ok {
r1 = rf(user)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).([]byte)
}
}
if rf, ok := ret.Get(2).(func(*model.User) *model.AppError); ok {
r2 = rf(user)
} else {
if ret.Get(2) != nil {
r2 = ret.Get(2).(*model.AppError)
}
}
return r0, r1, r2
}
// ValidateToken provides a mock function with given fields: secret, token
func (_m *MfaInterface) ValidateToken(secret string, token string) (bool, *model.AppError) {
ret := _m.Called(secret, token)
var r0 bool
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, string) (bool, *model.AppError)); ok {
return rf(secret, token)
}
if rf, ok := ret.Get(0).(func(string, string) bool); ok {
r0 = rf(secret, token)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(string, string) *model.AppError); ok {
r1 = rf(secret, token)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
type mockConstructorTestingTNewMfaInterface interface {
mock.TestingT
Cleanup(func())
}
// NewMfaInterface creates a new instance of MfaInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewMfaInterface(t mockConstructorTestingTNewMfaInterface) *MfaInterface {
mock := &MfaInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,82 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
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"
)
// NotificationInterface is an autogenerated mock type for the NotificationInterface type
type NotificationInterface struct {
mock.Mock
}
// CheckLicense provides a mock function with no fields
func (_m *NotificationInterface) CheckLicense() *model.AppError {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for CheckLicense")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func() *model.AppError); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// GetNotificationMessage provides a mock function with given fields: rctx, ack, userID
func (_m *NotificationInterface) GetNotificationMessage(rctx request.CTX, ack *model.PushNotificationAck, userID string) (*model.PushNotification, *model.AppError) {
ret := _m.Called(rctx, ack, userID)
if len(ret) == 0 {
panic("no return value specified for GetNotificationMessage")
}
var r0 *model.PushNotification
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, *model.PushNotificationAck, string) (*model.PushNotification, *model.AppError)); ok {
return rf(rctx, ack, userID)
}
if rf, ok := ret.Get(0).(func(request.CTX, *model.PushNotificationAck, string) *model.PushNotification); ok {
r0 = rf(rctx, ack, userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.PushNotification)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, *model.PushNotificationAck, string) *model.AppError); ok {
r1 = rf(rctx, ack, userID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// NewNotificationInterface creates a new instance of NotificationInterface. 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 NewNotificationInterface(t interface {
mock.TestingT
Cleanup(func())
}) *NotificationInterface {
mock := &NotificationInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,159 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
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"
)
// OAuthOutgoingConnectionInterface is an autogenerated mock type for the OAuthOutgoingConnectionInterface type
type OAuthOutgoingConnectionInterface struct {
mock.Mock
}
// DeleteConnection provides a mock function with given fields: rctx, id
func (_m *OAuthOutgoingConnectionInterface) DeleteConnection(rctx request.CTX, id string) *model.AppError {
ret := _m.Called(rctx, id)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) *model.AppError); ok {
r0 = rf(rctx, id)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// GetConnection provides a mock function with given fields: rctx, id
func (_m *OAuthOutgoingConnectionInterface) GetConnection(rctx request.CTX, id string) (*model.OutgoingOAuthConnectionGrantType, *model.AppError) {
ret := _m.Called(rctx, id)
var r0 *model.OutgoingOAuthConnectionGrantType
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) (*model.OutgoingOAuthConnectionGrantType, *model.AppError)); ok {
return rf(rctx, id)
}
if rf, ok := ret.Get(0).(func(request.CTX, string) *model.OutgoingOAuthConnectionGrantType); ok {
r0 = rf(rctx, id)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.OutgoingOAuthConnectionGrantType)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, id)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetConnections provides a mock function with given fields: rctx, filters
func (_m *OAuthOutgoingConnectionInterface) GetConnections(rctx request.CTX, filters model.OutgoingOAuthConnectionGetConnectionsFilter) ([]*model.OutgoingOAuthConnectionGrantType, *model.AppError) {
ret := _m.Called(rctx, filters)
var r0 []*model.OutgoingOAuthConnectionGrantType
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, model.OutgoingOAuthConnectionGetConnectionsFilter) ([]*model.OutgoingOAuthConnectionGrantType, *model.AppError)); ok {
return rf(rctx, filters)
}
if rf, ok := ret.Get(0).(func(request.CTX, model.OutgoingOAuthConnectionGetConnectionsFilter) []*model.OutgoingOAuthConnectionGrantType); ok {
r0 = rf(rctx, filters)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.OutgoingOAuthConnectionGrantType)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, model.OutgoingOAuthConnectionGetConnectionsFilter) *model.AppError); ok {
r1 = rf(rctx, filters)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// SaveConnection provides a mock function with given fields: rctx, conn
func (_m *OAuthOutgoingConnectionInterface) SaveConnection(rctx request.CTX, conn *model.OutgoingOAuthConnectionGrantType) (*model.OutgoingOAuthConnectionGrantType, *model.AppError) {
ret := _m.Called(rctx, conn)
var r0 *model.OutgoingOAuthConnectionGrantType
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, *model.OutgoingOAuthConnectionGrantType) (*model.OutgoingOAuthConnectionGrantType, *model.AppError)); ok {
return rf(rctx, conn)
}
if rf, ok := ret.Get(0).(func(request.CTX, *model.OutgoingOAuthConnectionGrantType) *model.OutgoingOAuthConnectionGrantType); ok {
r0 = rf(rctx, conn)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.OutgoingOAuthConnectionGrantType)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, *model.OutgoingOAuthConnectionGrantType) *model.AppError); ok {
r1 = rf(rctx, conn)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// UpdateConnection provides a mock function with given fields: rctx, conn
func (_m *OAuthOutgoingConnectionInterface) UpdateConnection(rctx request.CTX, conn *model.OutgoingOAuthConnectionGrantType) (*model.OutgoingOAuthConnectionGrantType, *model.AppError) {
ret := _m.Called(rctx, conn)
var r0 *model.OutgoingOAuthConnectionGrantType
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, *model.OutgoingOAuthConnectionGrantType) (*model.OutgoingOAuthConnectionGrantType, *model.AppError)); ok {
return rf(rctx, conn)
}
if rf, ok := ret.Get(0).(func(request.CTX, *model.OutgoingOAuthConnectionGrantType) *model.OutgoingOAuthConnectionGrantType); ok {
r0 = rf(rctx, conn)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.OutgoingOAuthConnectionGrantType)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, *model.OutgoingOAuthConnectionGrantType) *model.AppError); ok {
r1 = rf(rctx, conn)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
type mockConstructorTestingTNewOAuthOutgoingConnectionInterface interface {
mock.TestingT
Cleanup(func())
}
// NewOAuthOutgoingConnectionInterface creates a new instance of OAuthOutgoingConnectionInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewOAuthOutgoingConnectionInterface(t mockConstructorTestingTNewOAuthOutgoingConnectionInterface) *OAuthOutgoingConnectionInterface {
mock := &OAuthOutgoingConnectionInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,140 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
io "io"
model "github.com/mattermost/mattermost/server/public/model"
request "github.com/mattermost/mattermost/server/public/shared/request"
mock "github.com/stretchr/testify/mock"
)
// OAuthProvider is an autogenerated mock type for the OAuthProvider type
type OAuthProvider struct {
mock.Mock
}
// GetSSOSettings provides a mock function with given fields: rctx, config, service
func (_m *OAuthProvider) GetSSOSettings(rctx request.CTX, config *model.Config, service string) (*model.SSOSettings, error) {
ret := _m.Called(rctx, config, service)
if len(ret) == 0 {
panic("no return value specified for GetSSOSettings")
}
var r0 *model.SSOSettings
var r1 error
if rf, ok := ret.Get(0).(func(request.CTX, *model.Config, string) (*model.SSOSettings, error)); ok {
return rf(rctx, config, service)
}
if rf, ok := ret.Get(0).(func(request.CTX, *model.Config, string) *model.SSOSettings); ok {
r0 = rf(rctx, config, service)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.SSOSettings)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, *model.Config, string) error); ok {
r1 = rf(rctx, config, service)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetUserFromIdToken provides a mock function with given fields: rctx, idToken
func (_m *OAuthProvider) GetUserFromIdToken(rctx request.CTX, idToken string) (*model.User, error) {
ret := _m.Called(rctx, idToken)
if len(ret) == 0 {
panic("no return value specified for GetUserFromIdToken")
}
var r0 *model.User
var r1 error
if rf, ok := ret.Get(0).(func(request.CTX, string) (*model.User, error)); ok {
return rf(rctx, idToken)
}
if rf, ok := ret.Get(0).(func(request.CTX, string) *model.User); ok {
r0 = rf(rctx, idToken)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.User)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string) error); ok {
r1 = rf(rctx, idToken)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetUserFromJSON provides a mock function with given fields: rctx, data, tokenUser, settings
func (_m *OAuthProvider) GetUserFromJSON(rctx request.CTX, data io.Reader, tokenUser *model.User, settings *model.SSOSettings) (*model.User, error) {
ret := _m.Called(rctx, data, tokenUser, settings)
if len(ret) == 0 {
panic("no return value specified for GetUserFromJSON")
}
var r0 *model.User
var r1 error
if rf, ok := ret.Get(0).(func(request.CTX, io.Reader, *model.User, *model.SSOSettings) (*model.User, error)); ok {
return rf(rctx, data, tokenUser, settings)
}
if rf, ok := ret.Get(0).(func(request.CTX, io.Reader, *model.User, *model.SSOSettings) *model.User); ok {
r0 = rf(rctx, data, tokenUser, settings)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.User)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, io.Reader, *model.User, *model.SSOSettings) error); ok {
r1 = rf(rctx, data, tokenUser, settings)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// IsSameUser provides a mock function with given fields: rctx, dbUser, oAuthUser
func (_m *OAuthProvider) IsSameUser(rctx request.CTX, dbUser *model.User, oAuthUser *model.User) bool {
ret := _m.Called(rctx, dbUser, oAuthUser)
if len(ret) == 0 {
panic("no return value specified for IsSameUser")
}
var r0 bool
if rf, ok := ret.Get(0).(func(request.CTX, *model.User, *model.User) bool); ok {
r0 = rf(rctx, dbUser, oAuthUser)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// NewOAuthProvider creates a new instance of OAuthProvider. 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 NewOAuthProvider(t interface {
mock.TestingT
Cleanup(func())
}) *OAuthProvider {
mock := &OAuthProvider{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,252 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
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"
)
// OutgoingOAuthConnectionInterface is an autogenerated mock type for the OutgoingOAuthConnectionInterface type
type OutgoingOAuthConnectionInterface struct {
mock.Mock
}
// DeleteConnection provides a mock function with given fields: rctx, id
func (_m *OutgoingOAuthConnectionInterface) DeleteConnection(rctx request.CTX, id string) *model.AppError {
ret := _m.Called(rctx, id)
if len(ret) == 0 {
panic("no return value specified for DeleteConnection")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) *model.AppError); ok {
r0 = rf(rctx, id)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// GetConnection provides a mock function with given fields: rctx, id
func (_m *OutgoingOAuthConnectionInterface) GetConnection(rctx request.CTX, id string) (*model.OutgoingOAuthConnection, *model.AppError) {
ret := _m.Called(rctx, id)
if len(ret) == 0 {
panic("no return value specified for GetConnection")
}
var r0 *model.OutgoingOAuthConnection
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) (*model.OutgoingOAuthConnection, *model.AppError)); ok {
return rf(rctx, id)
}
if rf, ok := ret.Get(0).(func(request.CTX, string) *model.OutgoingOAuthConnection); ok {
r0 = rf(rctx, id)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.OutgoingOAuthConnection)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, id)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetConnectionForAudience provides a mock function with given fields: rctx, url
func (_m *OutgoingOAuthConnectionInterface) GetConnectionForAudience(rctx request.CTX, url string) (*model.OutgoingOAuthConnection, *model.AppError) {
ret := _m.Called(rctx, url)
if len(ret) == 0 {
panic("no return value specified for GetConnectionForAudience")
}
var r0 *model.OutgoingOAuthConnection
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) (*model.OutgoingOAuthConnection, *model.AppError)); ok {
return rf(rctx, url)
}
if rf, ok := ret.Get(0).(func(request.CTX, string) *model.OutgoingOAuthConnection); ok {
r0 = rf(rctx, url)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.OutgoingOAuthConnection)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, url)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetConnections provides a mock function with given fields: rctx, filters
func (_m *OutgoingOAuthConnectionInterface) GetConnections(rctx request.CTX, filters model.OutgoingOAuthConnectionGetConnectionsFilter) ([]*model.OutgoingOAuthConnection, *model.AppError) {
ret := _m.Called(rctx, filters)
if len(ret) == 0 {
panic("no return value specified for GetConnections")
}
var r0 []*model.OutgoingOAuthConnection
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, model.OutgoingOAuthConnectionGetConnectionsFilter) ([]*model.OutgoingOAuthConnection, *model.AppError)); ok {
return rf(rctx, filters)
}
if rf, ok := ret.Get(0).(func(request.CTX, model.OutgoingOAuthConnectionGetConnectionsFilter) []*model.OutgoingOAuthConnection); ok {
r0 = rf(rctx, filters)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.OutgoingOAuthConnection)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, model.OutgoingOAuthConnectionGetConnectionsFilter) *model.AppError); ok {
r1 = rf(rctx, filters)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// RetrieveTokenForConnection provides a mock function with given fields: rctx, conn
func (_m *OutgoingOAuthConnectionInterface) RetrieveTokenForConnection(rctx request.CTX, conn *model.OutgoingOAuthConnection) (*model.OutgoingOAuthConnectionToken, *model.AppError) {
ret := _m.Called(rctx, conn)
if len(ret) == 0 {
panic("no return value specified for RetrieveTokenForConnection")
}
var r0 *model.OutgoingOAuthConnectionToken
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, *model.OutgoingOAuthConnection) (*model.OutgoingOAuthConnectionToken, *model.AppError)); ok {
return rf(rctx, conn)
}
if rf, ok := ret.Get(0).(func(request.CTX, *model.OutgoingOAuthConnection) *model.OutgoingOAuthConnectionToken); ok {
r0 = rf(rctx, conn)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.OutgoingOAuthConnectionToken)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, *model.OutgoingOAuthConnection) *model.AppError); ok {
r1 = rf(rctx, conn)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// SanitizeConnection provides a mock function with given fields: conn
func (_m *OutgoingOAuthConnectionInterface) SanitizeConnection(conn *model.OutgoingOAuthConnection) {
_m.Called(conn)
}
// SanitizeConnections provides a mock function with given fields: conns
func (_m *OutgoingOAuthConnectionInterface) SanitizeConnections(conns []*model.OutgoingOAuthConnection) {
_m.Called(conns)
}
// SaveConnection provides a mock function with given fields: rctx, conn
func (_m *OutgoingOAuthConnectionInterface) SaveConnection(rctx request.CTX, conn *model.OutgoingOAuthConnection) (*model.OutgoingOAuthConnection, *model.AppError) {
ret := _m.Called(rctx, conn)
if len(ret) == 0 {
panic("no return value specified for SaveConnection")
}
var r0 *model.OutgoingOAuthConnection
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, *model.OutgoingOAuthConnection) (*model.OutgoingOAuthConnection, *model.AppError)); ok {
return rf(rctx, conn)
}
if rf, ok := ret.Get(0).(func(request.CTX, *model.OutgoingOAuthConnection) *model.OutgoingOAuthConnection); ok {
r0 = rf(rctx, conn)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.OutgoingOAuthConnection)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, *model.OutgoingOAuthConnection) *model.AppError); ok {
r1 = rf(rctx, conn)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// UpdateConnection provides a mock function with given fields: rctx, conn
func (_m *OutgoingOAuthConnectionInterface) UpdateConnection(rctx request.CTX, conn *model.OutgoingOAuthConnection) (*model.OutgoingOAuthConnection, *model.AppError) {
ret := _m.Called(rctx, conn)
if len(ret) == 0 {
panic("no return value specified for UpdateConnection")
}
var r0 *model.OutgoingOAuthConnection
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, *model.OutgoingOAuthConnection) (*model.OutgoingOAuthConnection, *model.AppError)); ok {
return rf(rctx, conn)
}
if rf, ok := ret.Get(0).(func(request.CTX, *model.OutgoingOAuthConnection) *model.OutgoingOAuthConnection); ok {
r0 = rf(rctx, conn)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.OutgoingOAuthConnection)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, *model.OutgoingOAuthConnection) *model.AppError); ok {
r1 = rf(rctx, conn)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// NewOutgoingOAuthConnectionInterface creates a new instance of OutgoingOAuthConnectionInterface. 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 NewOutgoingOAuthConnectionInterface(t interface {
mock.TestingT
Cleanup(func())
}) *OutgoingOAuthConnectionInterface {
mock := &OutgoingOAuthConnectionInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,590 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
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"
)
// PolicyAdministrationPointInterface is an autogenerated mock type for the PolicyAdministrationPointInterface type
type PolicyAdministrationPointInterface struct {
mock.Mock
}
// CheckExpression provides a mock function with given fields: rctx, expression
func (_m *PolicyAdministrationPointInterface) CheckExpression(rctx request.CTX, expression string) ([]model.CELExpressionError, *model.AppError) {
ret := _m.Called(rctx, expression)
if len(ret) == 0 {
panic("no return value specified for CheckExpression")
}
var r0 []model.CELExpressionError
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) ([]model.CELExpressionError, *model.AppError)); ok {
return rf(rctx, expression)
}
if rf, ok := ret.Get(0).(func(request.CTX, string) []model.CELExpressionError); ok {
r0 = rf(rctx, expression)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]model.CELExpressionError)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, expression)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// DeletePolicy provides a mock function with given fields: rctx, id
func (_m *PolicyAdministrationPointInterface) DeletePolicy(rctx request.CTX, id string) *model.AppError {
ret := _m.Called(rctx, id)
if len(ret) == 0 {
panic("no return value specified for DeletePolicy")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) *model.AppError); ok {
r0 = rf(rctx, id)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// ExpressionToVisualAST provides a mock function with given fields: rctx, expression
func (_m *PolicyAdministrationPointInterface) ExpressionToVisualAST(rctx request.CTX, expression string) (*model.VisualExpression, *model.AppError) {
ret := _m.Called(rctx, expression)
if len(ret) == 0 {
panic("no return value specified for ExpressionToVisualAST")
}
var r0 *model.VisualExpression
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) (*model.VisualExpression, *model.AppError)); ok {
return rf(rctx, expression)
}
if rf, ok := ret.Get(0).(func(request.CTX, string) *model.VisualExpression); ok {
r0 = rf(rctx, expression)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.VisualExpression)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, expression)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetChannelMembersToRemove provides a mock function with given fields: rctx, channelID
func (_m *PolicyAdministrationPointInterface) GetChannelMembersToRemove(rctx request.CTX, channelID string) ([]*model.ChannelMember, *model.AppError) {
ret := _m.Called(rctx, channelID)
if len(ret) == 0 {
panic("no return value specified for GetChannelMembersToRemove")
}
var r0 []*model.ChannelMember
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) ([]*model.ChannelMember, *model.AppError)); ok {
return rf(rctx, channelID)
}
if rf, ok := ret.Get(0).(func(request.CTX, string) []*model.ChannelMember); ok {
r0 = rf(rctx, channelID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.ChannelMember)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, channelID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetPoliciesForFieldIDs provides a mock function with given fields: rctx, fieldIDs
func (_m *PolicyAdministrationPointInterface) GetPoliciesForFieldIDs(rctx request.CTX, fieldIDs []string) ([]*model.AccessControlPolicy, *model.AppError) {
ret := _m.Called(rctx, fieldIDs)
if len(ret) == 0 {
panic("no return value specified for GetPoliciesForFieldIDs")
}
var r0 []*model.AccessControlPolicy
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, []string) ([]*model.AccessControlPolicy, *model.AppError)); ok {
return rf(rctx, fieldIDs)
}
if rf, ok := ret.Get(0).(func(request.CTX, []string) []*model.AccessControlPolicy); ok {
r0 = rf(rctx, fieldIDs)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.AccessControlPolicy)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, []string) *model.AppError); ok {
r1 = rf(rctx, fieldIDs)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetPolicy provides a mock function with given fields: rctx, id
func (_m *PolicyAdministrationPointInterface) GetPolicy(rctx request.CTX, id string) (*model.AccessControlPolicy, *model.AppError) {
ret := _m.Called(rctx, id)
if len(ret) == 0 {
panic("no return value specified for GetPolicy")
}
var r0 *model.AccessControlPolicy
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) (*model.AccessControlPolicy, *model.AppError)); ok {
return rf(rctx, id)
}
if rf, ok := ret.Get(0).(func(request.CTX, string) *model.AccessControlPolicy); ok {
r0 = rf(rctx, id)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AccessControlPolicy)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, id)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetPolicyRuleAttributes provides a mock function with given fields: rctx, policyID, action
func (_m *PolicyAdministrationPointInterface) GetPolicyRuleAttributes(rctx request.CTX, policyID string, action string) (map[string][]string, *model.AppError) {
ret := _m.Called(rctx, policyID, action)
if len(ret) == 0 {
panic("no return value specified for GetPolicyRuleAttributes")
}
var r0 map[string][]string
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, string) (map[string][]string, *model.AppError)); ok {
return rf(rctx, policyID, action)
}
if rf, ok := ret.Get(0).(func(request.CTX, string, string) map[string][]string); ok {
r0 = rf(rctx, policyID, action)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[string][]string)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string, string) *model.AppError); ok {
r1 = rf(rctx, policyID, action)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetTeamMembersToRemove provides a mock function with given fields: rctx, teamID
func (_m *PolicyAdministrationPointInterface) GetTeamMembersToRemove(rctx request.CTX, teamID string) ([]*model.TeamMember, *model.AppError) {
ret := _m.Called(rctx, teamID)
if len(ret) == 0 {
panic("no return value specified for GetTeamMembersToRemove")
}
var r0 []*model.TeamMember
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) ([]*model.TeamMember, *model.AppError)); ok {
return rf(rctx, teamID)
}
if rf, ok := ret.Get(0).(func(request.CTX, string) []*model.TeamMember); ok {
r0 = rf(rctx, teamID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.TeamMember)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, teamID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// HasMaskedValuesForCaller provides a mock function with given fields: rctx, expression, resolver
func (_m *PolicyAdministrationPointInterface) HasMaskedValuesForCaller(rctx request.CTX, expression string, resolver model.MaskingFieldResolver) (bool, *model.AppError) {
ret := _m.Called(rctx, expression, resolver)
if len(ret) == 0 {
panic("no return value specified for HasMaskedValuesForCaller")
}
var r0 bool
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, model.MaskingFieldResolver) (bool, *model.AppError)); ok {
return rf(rctx, expression, resolver)
}
if rf, ok := ret.Get(0).(func(request.CTX, string, model.MaskingFieldResolver) bool); ok {
r0 = rf(rctx, expression, resolver)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(request.CTX, string, model.MaskingFieldResolver) *model.AppError); ok {
r1 = rf(rctx, expression, resolver)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// Init provides a mock function with given fields: rctx
func (_m *PolicyAdministrationPointInterface) Init(rctx request.CTX) *model.AppError {
ret := _m.Called(rctx)
if len(ret) == 0 {
panic("no return value specified for Init")
}
var r0 *model.AppError
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)
}
}
return r0
}
// MaskExpressionForCaller provides a mock function with given fields: rctx, expression, resolver
func (_m *PolicyAdministrationPointInterface) MaskExpressionForCaller(rctx request.CTX, expression string, resolver model.MaskingFieldResolver) (string, bool, *model.AppError) {
ret := _m.Called(rctx, expression, resolver)
if len(ret) == 0 {
panic("no return value specified for MaskExpressionForCaller")
}
var r0 string
var r1 bool
var r2 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, model.MaskingFieldResolver) (string, bool, *model.AppError)); ok {
return rf(rctx, expression, resolver)
}
if rf, ok := ret.Get(0).(func(request.CTX, string, model.MaskingFieldResolver) string); ok {
r0 = rf(rctx, expression, resolver)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(request.CTX, string, model.MaskingFieldResolver) bool); ok {
r1 = rf(rctx, expression, resolver)
} else {
r1 = ret.Get(1).(bool)
}
if rf, ok := ret.Get(2).(func(request.CTX, string, model.MaskingFieldResolver) *model.AppError); ok {
r2 = rf(rctx, expression, resolver)
} else {
if ret.Get(2) != nil {
r2 = ret.Get(2).(*model.AppError)
}
}
return r0, r1, r2
}
// MergeExpressionWithMaskedValuesCanonical provides a mock function with given fields: rctx, submittedExpr, storedExpr, resolver
func (_m *PolicyAdministrationPointInterface) MergeExpressionWithMaskedValuesCanonical(rctx request.CTX, submittedExpr string, storedExpr string, resolver model.MaskingFieldResolver) (string, *model.AppError) {
ret := _m.Called(rctx, submittedExpr, storedExpr, resolver)
if len(ret) == 0 {
panic("no return value specified for MergeExpressionWithMaskedValuesCanonical")
}
var r0 string
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, string, model.MaskingFieldResolver) (string, *model.AppError)); ok {
return rf(rctx, submittedExpr, storedExpr, resolver)
}
if rf, ok := ret.Get(0).(func(request.CTX, string, string, model.MaskingFieldResolver) string); ok {
r0 = rf(rctx, submittedExpr, storedExpr, resolver)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(request.CTX, string, string, model.MaskingFieldResolver) *model.AppError); ok {
r1 = rf(rctx, submittedExpr, storedExpr, resolver)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// NormalizePolicy provides a mock function with given fields: rctx, policy
func (_m *PolicyAdministrationPointInterface) NormalizePolicy(rctx request.CTX, policy *model.AccessControlPolicy) (*model.AccessControlPolicy, *model.AppError) {
ret := _m.Called(rctx, policy)
if len(ret) == 0 {
panic("no return value specified for NormalizePolicy")
}
var r0 *model.AccessControlPolicy
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, *model.AccessControlPolicy) (*model.AccessControlPolicy, *model.AppError)); ok {
return rf(rctx, policy)
}
if rf, ok := ret.Get(0).(func(request.CTX, *model.AccessControlPolicy) *model.AccessControlPolicy); ok {
r0 = rf(rctx, policy)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AccessControlPolicy)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, *model.AccessControlPolicy) *model.AppError); ok {
r1 = rf(rctx, policy)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// OnPropertyFieldOptionsChanged provides a mock function with given fields: rctx, fieldID
func (_m *PolicyAdministrationPointInterface) OnPropertyFieldOptionsChanged(rctx request.CTX, fieldID string) {
_m.Called(rctx, fieldID)
}
// QueryUsersForExpression provides a mock function with given fields: rctx, expression, opts
func (_m *PolicyAdministrationPointInterface) QueryUsersForExpression(rctx request.CTX, expression string, opts model.SubjectSearchOptions) ([]*model.User, int64, *model.AppError) {
ret := _m.Called(rctx, expression, opts)
if len(ret) == 0 {
panic("no return value specified for QueryUsersForExpression")
}
var r0 []*model.User
var r1 int64
var r2 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, model.SubjectSearchOptions) ([]*model.User, int64, *model.AppError)); ok {
return rf(rctx, expression, opts)
}
if rf, ok := ret.Get(0).(func(request.CTX, string, model.SubjectSearchOptions) []*model.User); ok {
r0 = rf(rctx, expression, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.User)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string, model.SubjectSearchOptions) int64); ok {
r1 = rf(rctx, expression, opts)
} else {
r1 = ret.Get(1).(int64)
}
if rf, ok := ret.Get(2).(func(request.CTX, string, model.SubjectSearchOptions) *model.AppError); ok {
r2 = rf(rctx, expression, opts)
} else {
if ret.Get(2) != nil {
r2 = ret.Get(2).(*model.AppError)
}
}
return r0, r1, r2
}
// QueryUsersForResource provides a mock function with given fields: rctx, resourceID, action, opts
func (_m *PolicyAdministrationPointInterface) QueryUsersForResource(rctx request.CTX, resourceID string, action string, opts model.SubjectSearchOptions) ([]*model.User, int64, *model.AppError) {
ret := _m.Called(rctx, resourceID, action, opts)
if len(ret) == 0 {
panic("no return value specified for QueryUsersForResource")
}
var r0 []*model.User
var r1 int64
var r2 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, string, model.SubjectSearchOptions) ([]*model.User, int64, *model.AppError)); ok {
return rf(rctx, resourceID, action, opts)
}
if rf, ok := ret.Get(0).(func(request.CTX, string, string, model.SubjectSearchOptions) []*model.User); ok {
r0 = rf(rctx, resourceID, action, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.User)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string, string, model.SubjectSearchOptions) int64); ok {
r1 = rf(rctx, resourceID, action, opts)
} else {
r1 = ret.Get(1).(int64)
}
if rf, ok := ret.Get(2).(func(request.CTX, string, string, model.SubjectSearchOptions) *model.AppError); ok {
r2 = rf(rctx, resourceID, action, opts)
} else {
if ret.Get(2) != nil {
r2 = ret.Get(2).(*model.AppError)
}
}
return r0, r1, r2
}
// SavePolicy provides a mock function with given fields: rctx, policy
func (_m *PolicyAdministrationPointInterface) SavePolicy(rctx request.CTX, policy *model.AccessControlPolicy) (*model.AccessControlPolicy, *model.AppError) {
ret := _m.Called(rctx, policy)
if len(ret) == 0 {
panic("no return value specified for SavePolicy")
}
var r0 *model.AccessControlPolicy
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, *model.AccessControlPolicy) (*model.AccessControlPolicy, *model.AppError)); ok {
return rf(rctx, policy)
}
if rf, ok := ret.Get(0).(func(request.CTX, *model.AccessControlPolicy) *model.AccessControlPolicy); ok {
r0 = rf(rctx, policy)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AccessControlPolicy)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, *model.AccessControlPolicy) *model.AppError); ok {
r1 = rf(rctx, policy)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// SimulatePolicyForUsers provides a mock function with given fields: rctx, params
func (_m *PolicyAdministrationPointInterface) SimulatePolicyForUsers(rctx request.CTX, params model.PolicySimulationByUsersParams) (*model.PolicySimulationResponse, *model.AppError) {
ret := _m.Called(rctx, params)
if len(ret) == 0 {
panic("no return value specified for SimulatePolicyForUsers")
}
var r0 *model.PolicySimulationResponse
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, model.PolicySimulationByUsersParams) (*model.PolicySimulationResponse, *model.AppError)); ok {
return rf(rctx, params)
}
if rf, ok := ret.Get(0).(func(request.CTX, model.PolicySimulationByUsersParams) *model.PolicySimulationResponse); ok {
r0 = rf(rctx, params)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.PolicySimulationResponse)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, model.PolicySimulationByUsersParams) *model.AppError); ok {
r1 = rf(rctx, params)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// ValidateExpressionValuesForCaller provides a mock function with given fields: rctx, expression, resolver
func (_m *PolicyAdministrationPointInterface) ValidateExpressionValuesForCaller(rctx request.CTX, expression string, resolver model.MaskingFieldResolver) *model.AppError {
ret := _m.Called(rctx, expression, resolver)
if len(ret) == 0 {
panic("no return value specified for ValidateExpressionValuesForCaller")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, model.MaskingFieldResolver) *model.AppError); ok {
r0 = rf(rctx, expression, resolver)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// NewPolicyAdministrationPointInterface creates a new instance of PolicyAdministrationPointInterface. 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 NewPolicyAdministrationPointInterface(t interface {
mock.TestingT
Cleanup(func())
}) *PolicyAdministrationPointInterface {
mock := &PolicyAdministrationPointInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,60 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
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"
)
// PolicyDecisionPointInterface is an autogenerated mock type for the PolicyDecisionPointInterface type
type PolicyDecisionPointInterface struct {
mock.Mock
}
// AccessEvaluation provides a mock function with given fields: rctx, accessRequest
func (_m *PolicyDecisionPointInterface) AccessEvaluation(rctx request.CTX, accessRequest model.AccessRequest) (model.AccessDecision, *model.AppError) {
ret := _m.Called(rctx, accessRequest)
if len(ret) == 0 {
panic("no return value specified for AccessEvaluation")
}
var r0 model.AccessDecision
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, model.AccessRequest) (model.AccessDecision, *model.AppError)); ok {
return rf(rctx, accessRequest)
}
if rf, ok := ret.Get(0).(func(request.CTX, model.AccessRequest) model.AccessDecision); ok {
r0 = rf(rctx, accessRequest)
} else {
r0 = ret.Get(0).(model.AccessDecision)
}
if rf, ok := ret.Get(1).(func(request.CTX, model.AccessRequest) *model.AppError); ok {
r1 = rf(rctx, accessRequest)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// NewPolicyDecisionPointInterface creates a new instance of PolicyDecisionPointInterface. 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 NewPolicyDecisionPointInterface(t interface {
mock.TestingT
Cleanup(func())
}) *PolicyDecisionPointInterface {
mock := &PolicyDecisionPointInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,128 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
jobs "github.com/mattermost/mattermost/server/v8/einterfaces/jobs"
mock "github.com/stretchr/testify/mock"
)
// PushProxyInterface is an autogenerated mock type for the PushProxyInterface type
type PushProxyInterface struct {
mock.Mock
}
// DeleteAuthToken provides a mock function with no fields
func (_m *PushProxyInterface) DeleteAuthToken() *model.AppError {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for DeleteAuthToken")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func() *model.AppError); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// GenerateAuthToken provides a mock function with no fields
func (_m *PushProxyInterface) GenerateAuthToken() *model.AppError {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GenerateAuthToken")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func() *model.AppError); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// GetAuthToken provides a mock function with no fields
func (_m *PushProxyInterface) GetAuthToken() string {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetAuthToken")
}
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// MakeScheduler provides a mock function with no fields
func (_m *PushProxyInterface) MakeScheduler() jobs.Scheduler {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeScheduler")
}
var r0 jobs.Scheduler
if rf, ok := ret.Get(0).(func() jobs.Scheduler); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(jobs.Scheduler)
}
}
return r0
}
// MakeWorker provides a mock function with no fields
func (_m *PushProxyInterface) MakeWorker() model.Worker {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for MakeWorker")
}
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
// NewPushProxyInterface creates a new instance of PushProxyInterface. 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 NewPushProxyInterface(t interface {
mock.TestingT
Cleanup(func())
}) *PushProxyInterface {
mock := &PushProxyInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,48 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
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"
)
// SamlDiagnosticInterface is an autogenerated mock type for the SamlDiagnosticInterface type
type SamlDiagnosticInterface struct {
mock.Mock
}
// RunSupportPacketTest provides a mock function with given fields: rctx, settings
func (_m *SamlDiagnosticInterface) RunSupportPacketTest(rctx request.CTX, settings model.SamlSettings) error {
ret := _m.Called(rctx, settings)
if len(ret) == 0 {
panic("no return value specified for RunSupportPacketTest")
}
var r0 error
if rf, ok := ret.Get(0).(func(request.CTX, model.SamlSettings) error); ok {
r0 = rf(rctx, settings)
} else {
r0 = ret.Error(0)
}
return r0
}
// NewSamlDiagnosticInterface creates a new instance of SamlDiagnosticInterface. 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 NewSamlDiagnosticInterface(t interface {
mock.TestingT
Cleanup(func())
}) *SamlDiagnosticInterface {
mock := &SamlDiagnosticInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,170 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
saml2 "github.com/mattermost/gosaml2"
model "github.com/mattermost/mattermost/server/public/model"
request "github.com/mattermost/mattermost/server/public/shared/request"
mock "github.com/stretchr/testify/mock"
)
// SamlInterface is an autogenerated mock type for the SamlInterface type
type SamlInterface struct {
mock.Mock
}
// BuildRequest provides a mock function with given fields: rctx, relayState
func (_m *SamlInterface) BuildRequest(rctx request.CTX, relayState string) (*model.SamlAuthRequest, *model.AppError) {
ret := _m.Called(rctx, relayState)
if len(ret) == 0 {
panic("no return value specified for BuildRequest")
}
var r0 *model.SamlAuthRequest
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string) (*model.SamlAuthRequest, *model.AppError)); ok {
return rf(rctx, relayState)
}
if rf, ok := ret.Get(0).(func(request.CTX, string) *model.SamlAuthRequest); ok {
r0 = rf(rctx, relayState)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.SamlAuthRequest)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string) *model.AppError); ok {
r1 = rf(rctx, relayState)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// CheckProviderAttributes provides a mock function with given fields: rctx, SS, ouser, patch
func (_m *SamlInterface) CheckProviderAttributes(rctx request.CTX, SS *model.SamlSettings, ouser *model.User, patch *model.UserPatch) string {
ret := _m.Called(rctx, SS, ouser, patch)
if len(ret) == 0 {
panic("no return value specified for CheckProviderAttributes")
}
var r0 string
if rf, ok := ret.Get(0).(func(request.CTX, *model.SamlSettings, *model.User, *model.UserPatch) string); ok {
r0 = rf(rctx, SS, ouser, patch)
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// ConfigureSP provides a mock function with given fields: rctx
func (_m *SamlInterface) ConfigureSP(rctx request.CTX) error {
ret := _m.Called(rctx)
if len(ret) == 0 {
panic("no return value specified for ConfigureSP")
}
var r0 error
if rf, ok := ret.Get(0).(func(request.CTX) error); ok {
r0 = rf(rctx)
} else {
r0 = ret.Error(0)
}
return r0
}
// DoLogin provides a mock function with given fields: rctx, encodedXML, relayState
func (_m *SamlInterface) DoLogin(rctx request.CTX, encodedXML string, relayState map[string]string) (*model.User, *saml2.AssertionInfo, *model.AppError) {
ret := _m.Called(rctx, encodedXML, relayState)
if len(ret) == 0 {
panic("no return value specified for DoLogin")
}
var r0 *model.User
var r1 *saml2.AssertionInfo
var r2 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, string, map[string]string) (*model.User, *saml2.AssertionInfo, *model.AppError)); ok {
return rf(rctx, encodedXML, relayState)
}
if rf, ok := ret.Get(0).(func(request.CTX, string, map[string]string) *model.User); ok {
r0 = rf(rctx, encodedXML, relayState)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.User)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, string, map[string]string) *saml2.AssertionInfo); ok {
r1 = rf(rctx, encodedXML, relayState)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*saml2.AssertionInfo)
}
}
if rf, ok := ret.Get(2).(func(request.CTX, string, map[string]string) *model.AppError); ok {
r2 = rf(rctx, encodedXML, relayState)
} else {
if ret.Get(2) != nil {
r2 = ret.Get(2).(*model.AppError)
}
}
return r0, r1, r2
}
// GetMetadata provides a mock function with given fields: rctx
func (_m *SamlInterface) GetMetadata(rctx request.CTX) (string, *model.AppError) {
ret := _m.Called(rctx)
if len(ret) == 0 {
panic("no return value specified for GetMetadata")
}
var r0 string
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX) (string, *model.AppError)); ok {
return rf(rctx)
}
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(request.CTX) *model.AppError); ok {
r1 = rf(rctx)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// NewSamlInterface creates a new instance of SamlInterface. 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 NewSamlInterface(t interface {
mock.TestingT
Cleanup(func())
}) *SamlInterface {
mock := &SamlInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,102 @@
// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
time "time"
model "github.com/mattermost/mattermost/server/public/model"
request "github.com/mattermost/mattermost/server/public/shared/request"
mock "github.com/stretchr/testify/mock"
)
// Scheduler is an autogenerated mock type for the Scheduler type
type Scheduler struct {
mock.Mock
}
// Enabled provides a mock function with given fields: cfg
func (_m *Scheduler) Enabled(cfg *model.Config) bool {
ret := _m.Called(cfg)
if len(ret) == 0 {
panic("no return value specified for Enabled")
}
var r0 bool
if rf, ok := ret.Get(0).(func(*model.Config) bool); ok {
r0 = rf(cfg)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// NextScheduleTime provides a mock function with given fields: cfg, now, pendingJobs, lastSuccessfulJob
func (_m *Scheduler) NextScheduleTime(cfg *model.Config, now time.Time, pendingJobs bool, lastSuccessfulJob *model.Job) *time.Time {
ret := _m.Called(cfg, now, pendingJobs, lastSuccessfulJob)
if len(ret) == 0 {
panic("no return value specified for NextScheduleTime")
}
var r0 *time.Time
if rf, ok := ret.Get(0).(func(*model.Config, time.Time, bool, *model.Job) *time.Time); ok {
r0 = rf(cfg, now, pendingJobs, lastSuccessfulJob)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*time.Time)
}
}
return r0
}
// ScheduleJob provides a mock function with given fields: rctx, cfg, pendingJobs, lastSuccessfulJob
func (_m *Scheduler) ScheduleJob(rctx request.CTX, cfg *model.Config, pendingJobs bool, lastSuccessfulJob *model.Job) (*model.Job, *model.AppError) {
ret := _m.Called(rctx, cfg, pendingJobs, lastSuccessfulJob)
if len(ret) == 0 {
panic("no return value specified for ScheduleJob")
}
var r0 *model.Job
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(request.CTX, *model.Config, bool, *model.Job) (*model.Job, *model.AppError)); ok {
return rf(rctx, cfg, pendingJobs, lastSuccessfulJob)
}
if rf, ok := ret.Get(0).(func(request.CTX, *model.Config, bool, *model.Job) *model.Job); ok {
r0 = rf(rctx, cfg, pendingJobs, lastSuccessfulJob)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Job)
}
}
if rf, ok := ret.Get(1).(func(request.CTX, *model.Config, bool, *model.Job) *model.AppError); ok {
r1 = rf(rctx, cfg, pendingJobs, lastSuccessfulJob)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// NewScheduler creates a new instance of Scheduler. 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 NewScheduler(t interface {
mock.TestingT
Cleanup(func())
}) *Scheduler {
mock := &Scheduler{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,14 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/request"
)
type NotificationInterface interface {
GetNotificationMessage(rctx request.CTX, ack *model.PushNotificationAck, userID string) (*model.PushNotification, *model.AppError)
CheckLicense() *model.AppError
}

View File

@@ -0,0 +1,32 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"io"
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/request"
)
type OAuthProvider interface {
GetUserFromJSON(rctx request.CTX, data io.Reader, tokenUser *model.User, settings *model.SSOSettings) (*model.User, error)
GetSSOSettings(rctx request.CTX, config *model.Config, service string) (*model.SSOSettings, error)
GetUserFromIdToken(rctx request.CTX, idToken string) (*model.User, error)
IsSameUser(rctx request.CTX, dbUser, oAuthUser *model.User) bool
}
var oauthProviders = make(map[string]OAuthProvider)
func RegisterOAuthProvider(name string, newProvider OAuthProvider) {
oauthProviders[name] = newProvider
}
func GetOAuthProvider(name string) OAuthProvider {
provider, ok := oauthProviders[name]
if ok {
return provider
}
return nil
}

View File

@@ -0,0 +1,23 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/request"
)
type OutgoingOAuthConnectionInterface interface {
DeleteConnection(rctx request.CTX, id string) *model.AppError
GetConnection(rctx request.CTX, id string) (*model.OutgoingOAuthConnection, *model.AppError)
GetConnections(rctx request.CTX, filters model.OutgoingOAuthConnectionGetConnectionsFilter) ([]*model.OutgoingOAuthConnection, *model.AppError)
SaveConnection(rctx request.CTX, conn *model.OutgoingOAuthConnection) (*model.OutgoingOAuthConnection, *model.AppError)
UpdateConnection(rctx request.CTX, conn *model.OutgoingOAuthConnection) (*model.OutgoingOAuthConnection, *model.AppError)
SanitizeConnection(conn *model.OutgoingOAuthConnection)
SanitizeConnections(conns []*model.OutgoingOAuthConnection)
GetConnectionForAudience(rctx request.CTX, url string) (*model.OutgoingOAuthConnection, *model.AppError)
RetrieveTokenForConnection(rctx request.CTX, conn *model.OutgoingOAuthConnection) (*model.OutgoingOAuthConnectionToken, *model.AppError)
}

85
server/einterfaces/pap.go Normal file
View File

@@ -0,0 +1,85 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/request"
)
// PolicyAdministrationPointInterface is the service that manages access control policies.
// It is responsible for creating, updating, and deleting policies.
// Also, it provides methods to check the validity of expressions and to retrieve policies.
type PolicyAdministrationPointInterface interface {
// Init initializes the policy administration point and intiates the CEL engine.
// It is an idempotent operation, meaning that it can be called multiple times.
Init(rctx request.CTX) *model.AppError
// GetPolicyRuleAttributes retrieves the attributes of the given policy.
// It returns a map of attribute names to their values for given action.
GetPolicyRuleAttributes(rctx request.CTX, policyID string, action string) (map[string][]string, *model.AppError)
// CheckExpression checks the validity of the given expression using the CEL engine.
// It returns a list of CELExpressionError if the expression is invalid.
// If the expression is valid, it returns an empty list.
CheckExpression(rctx request.CTX, expression string) ([]model.CELExpressionError, *model.AppError)
// ExpressionToVisualAST converts the given expression to a visual AST.
ExpressionToVisualAST(rctx request.CTX, expression string) (*model.VisualExpression, *model.AppError)
// NormalizePolicy normalizes the given policy by restoring ids back to names.
NormalizePolicy(rctx request.CTX, policy *model.AccessControlPolicy) (*model.AccessControlPolicy, *model.AppError)
// QueryUsersForExpression evaluates the given expression using the CEL engine.
// It returns a list of users that match the expression.
QueryUsersForExpression(rctx request.CTX, expression string, opts model.SubjectSearchOptions) ([]*model.User, int64, *model.AppError)
// QueryUsersForResource evaluates finds the users match to the resource.
QueryUsersForResource(rctx request.CTX, resourceID, action string, opts model.SubjectSearchOptions) ([]*model.User, int64, *model.AppError)
// GetChannelMembersToRemove retrieves the channel members that need to be removed from the given channel.
GetChannelMembersToRemove(rctx request.CTX, channelID string) ([]*model.ChannelMember, *model.AppError)
// GetTeamMembersToRemove retrieves the team members that need to be removed from the given team.
GetTeamMembersToRemove(rctx request.CTX, teamID string) ([]*model.TeamMember, *model.AppError)
// SavePolicy saves the given access control policy.
SavePolicy(rctx request.CTX, policy *model.AccessControlPolicy) (*model.AccessControlPolicy, *model.AppError)
// GetPolicy retrieves the access control policy with the given ID.
GetPolicy(rctx request.CTX, id string) (*model.AccessControlPolicy, *model.AppError)
// DeletePolicy deletes the access control policy with the given ID.
DeletePolicy(rctx request.CTX, id string) *model.AppError
// GetPoliciesForFieldIDs returns the policies that reference any of the given
// property field IDs in their CEL rule expressions.
GetPoliciesForFieldIDs(rctx request.CTX, fieldIDs []string) ([]*model.AccessControlPolicy, *model.AppError)
// SimulatePolicyForUsers evaluates a DRAFT policy against an explicit
// user list (with optional per-user session attribute overrides) and
// returns per-user, per-action ALLOW/DENY decisions plus blame
// attribution. The draft is compiled in-memory only; nothing is
// persisted. Backs the picker-based "Simulate access" UX in the
// System Console and Channel Settings.
SimulatePolicyForUsers(rctx request.CTX, params model.PolicySimulationByUsersParams) (*model.PolicySimulationResponse, *model.AppError)
// OnPropertyFieldOptionsChanged signals the access control service that
// a property field's options changed (e.g. an admin re-ranked or
// renamed options on a rank-typed field). The service invalidates any
// cached per-field metadata and clears compiled-policy cache entries
// for policies that reference the field so subsequent evaluations
// re-read the authoritative values. Safe to call for any field type;
// the service no-ops for fields it does not track.
OnPropertyFieldOptionsChanged(rctx request.CTX, fieldID string)
// HasMaskedValuesForCaller reports whether expression contains any literal
// value hidden from the caller according to resolver. Returns an error when
// field resolution or CEL parsing fails — callers must treat any error as
// fail-closed (assume values are hidden).
HasMaskedValuesForCaller(rctx request.CTX, expression string, resolver model.MaskingFieldResolver) (bool, *model.AppError)
// MaskExpressionForCaller rewrites hidden literal values in expression to
// the masked token and returns the modified CEL string. The logical tree
// shape is preserved (|| / grouping / function calls are not flattened).
MaskExpressionForCaller(rctx request.CTX, expression string, resolver model.MaskingFieldResolver) (string, bool, *model.AppError)
// ValidateExpressionValuesForCaller walks expression and returns an error
// if any non-token literal is forbidden for the caller under resolver's
// visibility rules.
ValidateExpressionValuesForCaller(rctx request.CTX, expression string, resolver model.MaskingFieldResolver) *model.AppError
// MergeExpressionWithMaskedValuesCanonical re-injects hidden stored
// literals from storedExpr into submittedExpr using a canonical CEL AST
// walk. Returns the merged CEL string. Fails closed when the submitted
// tree's shape diverges from stored while hidden values are present.
MergeExpressionWithMaskedValuesCanonical(rctx request.CTX, submittedExpr, storedExpr string, resolver model.MaskingFieldResolver) (string, *model.AppError)
}

16
server/einterfaces/pdp.go Normal file
View File

@@ -0,0 +1,16 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/request"
)
// PolicyDecisionPointInterface is the service that evaluates access requests
// using the OpenID Auth API spec. It determines whether a subject can perform
// an action on a resource based on the resource policy.
type PolicyDecisionPointInterface interface {
AccessEvaluation(rctx request.CTX, accessRequest model.AccessRequest) (model.AccessDecision, *model.AppError)
}

View File

@@ -0,0 +1,27 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost/server/public/model"
ejobs "github.com/mattermost/mattermost/server/v8/einterfaces/jobs"
)
type PushProxyInterface interface {
// GetAuthToken returns the current auth token
// Returns empty string if not available or enterprise is not enabled
GetAuthToken() string
// GenerateAuthToken generates and stores an authentication token
GenerateAuthToken() *model.AppError
// DeleteAuthToken deletes the stored authentication token
DeleteAuthToken() *model.AppError
// MakeWorker creates a worker for the auth token generation job
MakeWorker() model.Worker
// MakeScheduler creates a scheduler for the auth token generation job
MakeScheduler() ejobs.Scheduler
}

View File

@@ -0,0 +1,18 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
saml2 "github.com/mattermost/gosaml2"
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/request"
)
type SamlInterface interface {
ConfigureSP(rctx request.CTX) error
BuildRequest(rctx request.CTX, relayState string) (*model.SamlAuthRequest, *model.AppError)
DoLogin(rctx request.CTX, encodedXML string, relayState map[string]string) (*model.User, *saml2.AssertionInfo, *model.AppError)
GetMetadata(rctx request.CTX) (string, *model.AppError)
CheckProviderAttributes(rctx request.CTX, SS *model.SamlSettings, ouser *model.User, patch *model.UserPatch) string
}

View File

@@ -0,0 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/request"
)
type SamlDiagnosticInterface interface {
RunSupportPacketTest(rctx request.CTX, settings model.SamlSettings) error
}