fixed app-layer generator, re-enabled struct2interface in make… (#14260)

* fixed app-layer generator, re-enabled struct2interface in makefile
Этот коммит содержится в:
Eli Yukelzon
2020-04-09 11:08:39 +03:00
коммит произвёл GitHub
родитель 1f036b7588
Коммит 819f57037b
4 изменённых файлов: 194 добавлений и 27 удалений

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

@@ -200,9 +200,8 @@ endif
endif
app-layers: ## Extract interface from App struct
# The following commented commands can be used to re-generate the AppIface from the App struct
#env GO111MODULE=off $(GO) get gopkg.in/reflog/struct2interface.v0
#$(GOBIN)/struct2interface.v0 -f "app" -o "app/app_iface.go" -p "app" -s "App" -i "AppIface" -t ./app/layer_generators/app_iface.go.tmpl
env GO111MODULE=off $(GO) get gopkg.in/reflog/struct2interface.v0
$(GOBIN)/struct2interface.v0 -f "app" -o "app/app_iface.go" -p "app" -s "App" -i "AppIface" -t ./app/layer_generators/app_iface.go.tmpl
$(GO) run ./app/layer_generators -in ./app/app_iface.go -out ./app/opentracing_layer.go -template ./app/layer_generators/opentracing_layer.go.tmpl
i18n-extract: ## Extract strings for translation from the source code

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

@@ -22,6 +22,7 @@ import (
"github.com/gorilla/websocket"
"github.com/mattermost/go-i18n/i18n"
goi18n "github.com/mattermost/go-i18n/i18n"
"github.com/mattermost/mattermost-server/v5/audit"
"github.com/mattermost/mattermost-server/v5/einterfaces"
"github.com/mattermost/mattermost-server/v5/mlog"
"github.com/mattermost/mattermost-server/v5/model"
@@ -36,6 +37,8 @@ import (
// AppIface is extracted from App struct and contains all it's exported methods. It's provided to allow partial interface passing and app layers creation.
type AppIface interface {
// @openTracingParams args
ExecuteCommand(args *model.CommandArgs) (*model.CommandResponse, *model.AppError)
// @openTracingParams teamId
// previous ListCommands now ListAutocompleteCommands
ListAutocompleteCommands(teamId string, T goi18n.TranslateFunc) ([]*model.Command, *model.AppError)
@@ -63,7 +66,10 @@ type AppIface interface {
ConvertUserToBot(user *model.User) (*model.Bot, *model.AppError)
// CreateBot creates the given bot and corresponding user.
CreateBot(bot *model.Bot) (*model.Bot, *model.AppError)
// CreateChannelScheme creates a new Scheme of scope channel and assigns it to the channel.
CreateChannelScheme(channel *model.Channel) (*model.Scheme, *model.AppError)
// CreateDefaultChannels creates channels in the given team for each channel returned by (*App).DefaultChannelNames.
//
CreateDefaultChannels(teamID string) ([]*model.Channel, *model.AppError)
// CreateDefaultMemberships adds users to teams and channels based on their group memberships and how those groups
// are configured to sync with teams and channels for group members on or after the given timestamp.
@@ -87,9 +93,12 @@ type AppIface interface {
// However, if TeamSettings.ExperimentalDefaultChannels contains a list of channels then that list will replace
// 'off-topic' and be included in the return results in addition to 'town-square'. For example:
// ['town-square', 'game-of-thrones', 'wow']
//
DefaultChannelNames() []string
// DeleteBotIconImage deletes LHS icon for a bot.
DeleteBotIconImage(botUserId string) *model.AppError
// DeleteChannelScheme deletes a channels scheme and sets its SchemeId to nil.
DeleteChannelScheme(channel *model.Channel) (*model.Channel, *model.AppError)
// DeleteGroupConstrainedMemberships deletes team and channel memberships of users who aren't members of the allowed
// groups of all group-constrained teams and channels.
DeleteGroupConstrainedMemberships() error
@@ -134,6 +143,8 @@ type AppIface interface {
GetBots(options *model.BotGetOptions) (model.BotList, *model.AppError)
// GetChannelGroupUsers returns the users who are associated to the channel via GroupChannels and GroupMembers.
GetChannelGroupUsers(channelID string) ([]*model.User, *model.AppError)
// GetChannelModerationsForChannel Gets a channels ChannelModerations from either the higherScoped roles or from the channel scheme roles.
GetChannelModerationsForChannel(channel *model.Channel) ([]*model.ChannelModeration, *model.AppError)
// GetClusterPluginStatuses returns the status for plugins installed anywhere in the cluster.
GetClusterPluginStatuses() (model.PluginStatuses, *model.AppError)
// GetConfigFile proxies access to the given configuration file to the underlying config store.
@@ -164,8 +175,12 @@ type AppIface interface {
GetPublicKey(name string) ([]byte, *model.AppError)
// GetSanitizedConfig gets the configuration for a system admin without any secrets.
GetSanitizedConfig() *model.Config
// GetSchemeRolesForChannel Checks if a channel or its team has an override scheme for channel roles and returns the scheme roles or default channel roles.
GetSchemeRolesForChannel(channelId string) (guestRoleName string, userRoleName string, adminRoleName string, err *model.AppError)
// GetTeamGroupUsers returns the users who are associated to the team via GroupTeams and GroupMembers.
GetTeamGroupUsers(teamID string) ([]*model.User, *model.AppError)
// GetTeamSchemeChannelRoles Checks if a team has an override scheme and returns the scheme channel role names or default channel role names.
GetTeamSchemeChannelRoles(teamId string) (guestRoleName string, userRoleName string, adminRoleName string, err *model.AppError)
// GetTotalUsersStats is used for the DM list total
GetTotalUsersStats(viewRestrictions *model.ViewUsersRestrictions) (*model.UsersStats, *model.AppError)
// InstallMarketplacePlugin installs a plugin listed in the marketplace server. It will get the plugin bundle
@@ -181,6 +196,12 @@ type AppIface interface {
License() *model.License
// LimitedClientConfigWithComputed gets the configuration in a format suitable for sending to the client.
LimitedClientConfigWithComputed() map[string]string
// LogAuditRec logs an audit record using default CLILevel.
LogAuditRec(rec *audit.Record, err error)
// LogAuditRecWithLevel logs an audit record using specified Level.
LogAuditRecWithLevel(rec *audit.Record, level audit.Level, err error)
// MakeAuditRecord creates a audit record pre-populated with defaults.
MakeAuditRecord(event string, initialStatus string) *audit.Record
// MarkChanelAsUnreadFromPost will take a post and set the channel as unread from that one.
MarkChannelAsUnreadFromPost(postID string, userID string) (*model.ChannelUnreadAt, *model.AppError)
// OverrideIconURLIfEmoji changes the post icon override URL prop, if it has an emoji icon,
@@ -188,6 +209,8 @@ type AppIface interface {
OverrideIconURLIfEmoji(post *model.Post)
// PatchBot applies the given patch to the bot and corresponding user.
PatchBot(botUserId string, botPatch *model.BotPatch) (*model.Bot, *model.AppError)
// PatchChannelModerationsForChannel Updates a channels scheme roles based on a given ChannelModerationPatch, if the permissions match the higher scoped role the scheme is deleted.
PatchChannelModerationsForChannel(channel *model.Channel, channelModerationsPatch []*model.ChannelModerationPatch) ([]*model.ChannelModeration, *model.AppError)
// Perform an HTTP POST request to an integration's action endpoint.
// Caller must consume and close returned http.Response as necessary.
// For internal requests, requests are routed directly to a plugin ServerHTTP hook
@@ -256,6 +279,8 @@ type AppIface interface {
UpdateBotOwner(botUserId, newOwnerId string) (*model.Bot, *model.AppError)
// UpdateChannel updates a given channel by its Id. It also publishes the CHANNEL_UPDATED event.
UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError)
// UpdateChannelScheme saves the new SchemeId of the channel passed.
UpdateChannelScheme(channel *model.Channel) (*model.Channel, *model.AppError)
// UploadFile uploads a single file in form of a completely constructed byte array for a channel.
UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError)
// UploadFileX uploads a single file as specified in t. It applies the upload
@@ -302,7 +327,7 @@ type AppIface interface {
AsymmetricSigningKey() *ecdsa.PrivateKey
AttachDeviceId(sessionId string, deviceId string, expiresAt int64) *model.AppError
AttachSessionCookies(w http.ResponseWriter, r *http.Request)
AuthenticateUserForLogin(id, loginId, password, mfaToken string, ldapOnly bool) (*model.User, *model.AppError)
AuthenticateUserForLogin(id, loginId, password, mfaToken string, ldapOnly bool) (user *model.User, err *model.AppError)
AuthorizeOAuthUser(w http.ResponseWriter, r *http.Request, service, code, state, redirectUri string) (io.ReadCloser, string, map[string]string, *model.AppError)
AutocompleteChannels(teamId string, term string) (*model.ChannelList, *model.AppError)
AutocompleteChannelsForSearch(teamId string, userId string, term string) (*model.ChannelList, *model.AppError)
@@ -356,7 +381,7 @@ type AppIface interface {
CreateOAuthUser(service string, userData io.Reader, teamId string) (*model.User, *model.AppError)
CreateOutgoingWebhook(hook *model.OutgoingWebhook) (*model.OutgoingWebhook, *model.AppError)
CreatePasswordRecoveryToken(userId, email string) (*model.Token, *model.AppError)
CreatePost(post *model.Post, channel *model.Channel, triggerWebhooks bool) (*model.Post, *model.AppError)
CreatePost(post *model.Post, channel *model.Channel, triggerWebhooks bool) (savedPost *model.Post, err *model.AppError)
CreatePostAsUser(post *model.Post, currentSessionId string) (*model.Post, *model.AppError)
CreatePostMissingChannel(post *model.Post, triggerWebhooks bool) (*model.Post, *model.AppError)
CreateRole(role *model.Role) (*model.Role, *model.AppError)
@@ -412,8 +437,6 @@ type AppIface interface {
DownloadFromURL(downloadURL string) ([]byte, error)
EnableUserAccessToken(token *model.UserAccessToken) *model.AppError
EnvironmentConfig() map[string]interface{}
// @openTracingParams args
ExecuteCommand(args *model.CommandArgs) (*model.CommandResponse, *model.AppError)
ExportPermissions(w io.Writer) error
FetchSamlMetadataFromIdp(url string) ([]byte, *model.AppError)
FileBackend() (filesstore.FileBackend, *model.AppError)
@@ -456,7 +479,6 @@ type AppIface interface {
GetChannelMembersForUserWithPagination(teamId, userId string, page, perPage int) ([]*model.ChannelMember, *model.AppError)
GetChannelMembersPage(channelId string, page, perPage int) (*model.ChannelMembers, *model.AppError)
GetChannelMembersTimezones(channelId string) ([]string, *model.AppError)
GetChannelModerationsForChannel(channel *model.Channel) ([]*model.ChannelModeration, *model.AppError)
GetChannelPinnedPostCount(channelId string) (int64, *model.AppError)
GetChannelUnread(channelId, userId string) (*model.ChannelUnread, *model.AppError)
GetChannelsByNames(channelNames []string, teamId string) ([]*model.Channel, *model.AppError)
@@ -575,7 +597,6 @@ type AppIface interface {
GetSanitizedClientLicense() map[string]string
GetScheme(id string) (*model.Scheme, *model.AppError)
GetSchemeByName(name string) (*model.Scheme, *model.AppError)
GetSchemeRolesForChannel(channelId string) (string, string, string, *model.AppError)
GetSchemeRolesForTeam(teamId string) (string, string, string, *model.AppError)
GetSchemes(scope string, offset int, limit int) ([]*model.Scheme, *model.AppError)
GetSchemesPage(scope string, page int, perPage int) ([]*model.Scheme, *model.AppError)
@@ -658,7 +679,7 @@ type AppIface interface {
HubUnregister(webConn *WebConn)
ImageProxy() *imageproxy.ImageProxy
ImageProxyAdder() func(string) string
ImageProxyRemover() func(string) string
ImageProxyRemover() (f func(string) string)
ImportPermissions(jsonl io.Reader) error
InitPlugins(pluginDir, webappPluginDir string)
InitPostMetadata()
@@ -666,6 +687,7 @@ type AppIface interface {
InvalidateAllCaches() *model.AppError
InvalidateAllCachesSkipSend()
InvalidateAllEmailInvites() *model.AppError
InvalidateCacheForUser(userId string)
InvalidateWebConnSessionCacheForUser(userId string)
InviteGuestsToChannels(teamId string, guestsInvite *model.GuestsInvite, senderId string) *model.AppError
InviteGuestsToChannelsGracefully(teamId string, guestsInvite *model.GuestsInvite, senderId string) ([]*model.EmailInviteWithError, *model.AppError)
@@ -708,7 +730,6 @@ type AppIface interface {
OpenInteractiveDialog(request model.OpenDialogRequest) *model.AppError
OriginChecker() func(*http.Request) bool
PatchChannel(channel *model.Channel, patch *model.ChannelPatch, userId string) (*model.Channel, *model.AppError)
PatchChannelModerationsForChannel(channel *model.Channel, channelModerationsPatch []*model.ChannelModerationPatch) ([]*model.ChannelModeration, *model.AppError)
PatchPost(postId string, patch *model.PostPatch) (*model.Post, *model.AppError)
PatchRole(role *model.Role, patch *model.RolePatch) (*model.Role, *model.AppError)
PatchScheme(scheme *model.Scheme, patch *model.SchemePatch) (*model.Scheme, *model.AppError)
@@ -844,6 +865,7 @@ type AppIface interface {
SetProfileImageFromMultiPartFile(userId string, file multipart.File) *model.AppError
SetRequestId(s string)
SetSamlIdpCertificateFromMetadata(data []byte) *model.AppError
SetSearchEngine(se *searchengine.Broker)
SetServer(srv *Server)
SetSession(s *model.Session)
SetStatusAwayIfNeeded(userId string, manual bool)
@@ -894,7 +916,6 @@ type AppIface interface {
UpdateChannelMemberRoles(channelId string, userId string, newRoles string) (*model.ChannelMember, *model.AppError)
UpdateChannelMemberSchemeRoles(channelId string, userId string, isSchemeGuest bool, isSchemeUser bool, isSchemeAdmin bool) (*model.ChannelMember, *model.AppError)
UpdateChannelPrivacy(oldChannel *model.Channel, user *model.User) (*model.Channel, *model.AppError)
UpdateChannelScheme(channel *model.Channel) (*model.Channel, *model.AppError)
UpdateCommand(oldCmd, updatedCmd *model.Command) (*model.Command, *model.AppError)
UpdateConfig(f func(*model.Config))
UpdateEphemeralPost(userId string, post *model.Post) *model.Post

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

@@ -100,11 +100,20 @@ func extractMethodMetadata(method *ast.Field, src []byte) methodData {
}
}
}
if e.Results != nil {
for _, result := range e.Results.List {
results = append(results, formatNode(src, result.Type))
for _, r := range e.Results.List {
typeStr := formatNode(src, r.Type)
if len(r.Names) > 0 {
for _, k := range r.Names {
results = append(results, fmt.Sprintf("%s %s", k.Name, typeStr))
}
} else {
results = append(results, typeStr)
}
}
}
for paramName := range paramsToTrace {
found := false
for _, param := range params {
@@ -179,12 +188,6 @@ func generateLayer(name, templateFile string) ([]byte, error) {
return strings.Join(results, ", ")
},
"joinResultsForSignature": func(results []string) string {
switch len(results) {
case 0:
return ""
case 1:
return strings.Join(results, ", ")
}
return fmt.Sprintf("(%s)", strings.Join(results, ", "))
},
"genResultsVars": func(results []string) string {
@@ -196,7 +199,7 @@ func generateLayer(name, templateFile string) ([]byte, error) {
},
"errorToBoolean": func(results []string) string {
for i, typeName := range results {
if typeName == APP_ERROR_TYPE {
if strings.Contains(typeName, APP_ERROR_TYPE) {
return fmt.Sprintf("resultVar%d == nil", i)
}
}
@@ -204,7 +207,7 @@ func generateLayer(name, templateFile string) ([]byte, error) {
},
"errorPresent": func(results []string) bool {
for _, typeName := range results {
if typeName == "*model.AppError" {
if strings.Contains(typeName, APP_ERROR_TYPE) {
return true
}
}
@@ -212,7 +215,7 @@ func generateLayer(name, templateFile string) ([]byte, error) {
},
"errorVar": func(results []string) string {
for i, typeName := range results {
if typeName == "*model.AppError" {
if strings.Contains(typeName, APP_ERROR_TYPE) {
return fmt.Sprintf("resultVar%d", i)
}
}

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

@@ -22,6 +22,7 @@ import (
"github.com/gorilla/websocket"
"github.com/mattermost/go-i18n/i18n"
goi18n "github.com/mattermost/go-i18n/i18n"
"github.com/mattermost/mattermost-server/v5/audit"
"github.com/mattermost/mattermost-server/v5/einterfaces"
"github.com/mattermost/mattermost-server/v5/mlog"
"github.com/mattermost/mattermost-server/v5/model"
@@ -616,7 +617,7 @@ func (a *OpenTracingAppLayer) AttachSessionCookies(w http.ResponseWriter, r *htt
a.app.AttachSessionCookies(w, r)
}
func (a *OpenTracingAppLayer) AuthenticateUserForLogin(id string, loginId string, password string, mfaToken string, ldapOnly bool) (*model.User, *model.AppError) {
func (a *OpenTracingAppLayer) AuthenticateUserForLogin(id string, loginId string, password string, mfaToken string, ldapOnly bool) (user *model.User, err *model.AppError) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.AuthenticateUserForLogin")
@@ -1483,6 +1484,28 @@ func (a *OpenTracingAppLayer) CreateChannel(channel *model.Channel, addMember bo
return resultVar0, resultVar1
}
func (a *OpenTracingAppLayer) CreateChannelScheme(channel *model.Channel) (*model.Scheme, *model.AppError) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.CreateChannelScheme")
a.ctx = newCtx
a.app.Srv().Store.SetContext(newCtx)
defer func() {
a.app.Srv().Store.SetContext(origCtx)
a.ctx = origCtx
}()
defer span.Finish()
resultVar0, resultVar1 := a.app.CreateChannelScheme(channel)
if resultVar1 != nil {
span.LogFields(spanlog.Error(resultVar1))
ext.Error.Set(span, true)
}
return resultVar0, resultVar1
}
func (a *OpenTracingAppLayer) CreateChannelWithUser(channel *model.Channel, userId string) (*model.Channel, *model.AppError) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.CreateChannelWithUser")
@@ -1856,7 +1879,7 @@ func (a *OpenTracingAppLayer) CreatePasswordRecoveryToken(userId string, email s
return resultVar0, resultVar1
}
func (a *OpenTracingAppLayer) CreatePost(post *model.Post, channel *model.Channel, triggerWebhooks bool) (*model.Post, *model.AppError) {
func (a *OpenTracingAppLayer) CreatePost(post *model.Post, channel *model.Channel, triggerWebhooks bool) (savedPost *model.Post, err *model.AppError) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.CreatePost")
@@ -2423,6 +2446,28 @@ func (a *OpenTracingAppLayer) DeleteChannel(channel *model.Channel, userId strin
return resultVar0
}
func (a *OpenTracingAppLayer) DeleteChannelScheme(channel *model.Channel) (*model.Channel, *model.AppError) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DeleteChannelScheme")
a.ctx = newCtx
a.app.Srv().Store.SetContext(newCtx)
defer func() {
a.app.Srv().Store.SetContext(origCtx)
a.ctx = origCtx
}()
defer span.Finish()
resultVar0, resultVar1 := a.app.DeleteChannelScheme(channel)
if resultVar1 != nil {
span.LogFields(spanlog.Error(resultVar1))
ext.Error.Set(span, true)
}
return resultVar0, resultVar1
}
func (a *OpenTracingAppLayer) DeleteCommand(commandId string) *model.AppError {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DeleteCommand")
@@ -7164,7 +7209,7 @@ func (a *OpenTracingAppLayer) GetSchemeByName(name string) (*model.Scheme, *mode
return resultVar0, resultVar1
}
func (a *OpenTracingAppLayer) GetSchemeRolesForChannel(channelId string) (string, string, string, *model.AppError) {
func (a *OpenTracingAppLayer) GetSchemeRolesForChannel(channelId string) (guestRoleName string, userRoleName string, adminRoleName string, err *model.AppError) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetSchemeRolesForChannel")
@@ -7660,6 +7705,28 @@ func (a *OpenTracingAppLayer) GetTeamMembersForUserWithPagination(userId string,
return resultVar0, resultVar1
}
func (a *OpenTracingAppLayer) GetTeamSchemeChannelRoles(teamId string) (guestRoleName string, userRoleName string, adminRoleName string, err *model.AppError) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetTeamSchemeChannelRoles")
a.ctx = newCtx
a.app.Srv().Store.SetContext(newCtx)
defer func() {
a.app.Srv().Store.SetContext(origCtx)
a.ctx = origCtx
}()
defer span.Finish()
resultVar0, resultVar1, resultVar2, resultVar3 := a.app.GetTeamSchemeChannelRoles(teamId)
if resultVar3 != nil {
span.LogFields(spanlog.Error(resultVar3))
ext.Error.Set(span, true)
}
return resultVar0, resultVar1, resultVar2, resultVar3
}
func (a *OpenTracingAppLayer) GetTeamStats(teamId string, restrictions *model.ViewUsersRestrictions) (*model.TeamStats, *model.AppError) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetTeamStats")
@@ -8881,7 +8948,7 @@ func (a *OpenTracingAppLayer) ImageProxyAdder() func(string) string {
return resultVar0
}
func (a *OpenTracingAppLayer) ImageProxyRemover() func(string) string {
func (a *OpenTracingAppLayer) ImageProxyRemover() (f func(string) string) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.ImageProxyRemover")
@@ -9085,6 +9152,21 @@ func (a *OpenTracingAppLayer) InvalidateAllEmailInvites() *model.AppError {
return resultVar0
}
func (a *OpenTracingAppLayer) InvalidateCacheForUser(userId string) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.InvalidateCacheForUser")
a.ctx = newCtx
a.app.Srv().Store.SetContext(newCtx)
defer func() {
a.app.Srv().Store.SetContext(origCtx)
a.ctx = origCtx
}()
defer span.Finish()
a.app.InvalidateCacheForUser(userId)
}
func (a *OpenTracingAppLayer) InvalidateWebConnSessionCacheForUser(userId string) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.InvalidateWebConnSessionCacheForUser")
@@ -9610,6 +9692,36 @@ func (a *OpenTracingAppLayer) LoadLicense() {
a.app.LoadLicense()
}
func (a *OpenTracingAppLayer) LogAuditRec(rec *audit.Record, err error) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.LogAuditRec")
a.ctx = newCtx
a.app.Srv().Store.SetContext(newCtx)
defer func() {
a.app.Srv().Store.SetContext(origCtx)
a.ctx = origCtx
}()
defer span.Finish()
a.app.LogAuditRec(rec, err)
}
func (a *OpenTracingAppLayer) LogAuditRecWithLevel(rec *audit.Record, level audit.Level, err error) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.LogAuditRecWithLevel")
a.ctx = newCtx
a.app.Srv().Store.SetContext(newCtx)
defer func() {
a.app.Srv().Store.SetContext(origCtx)
a.ctx = origCtx
}()
defer span.Finish()
a.app.LogAuditRecWithLevel(rec, level, err)
}
func (a *OpenTracingAppLayer) LoginByOAuth(service string, userData io.Reader, teamId string) (*model.User, *model.AppError) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.LoginByOAuth")
@@ -9632,6 +9744,23 @@ func (a *OpenTracingAppLayer) LoginByOAuth(service string, userData io.Reader, t
return resultVar0, resultVar1
}
func (a *OpenTracingAppLayer) MakeAuditRecord(event string, initialStatus string) *audit.Record {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.MakeAuditRecord")
a.ctx = newCtx
a.app.Srv().Store.SetContext(newCtx)
defer func() {
a.app.Srv().Store.SetContext(origCtx)
a.ctx = origCtx
}()
defer span.Finish()
resultVar0 := a.app.MakeAuditRecord(event, initialStatus)
return resultVar0
}
func (a *OpenTracingAppLayer) MakePermissionError(permission *model.Permission) *model.AppError {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.MakePermissionError")
@@ -12781,6 +12910,21 @@ func (a *OpenTracingAppLayer) SetSamlIdpCertificateFromMetadata(data []byte) *mo
return resultVar0
}
func (a *OpenTracingAppLayer) SetSearchEngine(se *searchengine.Broker) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.SetSearchEngine")
a.ctx = newCtx
a.app.Srv().Store.SetContext(newCtx)
defer func() {
a.app.Srv().Store.SetContext(origCtx)
a.ctx = origCtx
}()
defer span.Finish()
a.app.SetSearchEngine(se)
}
func (a *OpenTracingAppLayer) SetStatusAwayIfNeeded(userId string, manual bool) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.SetStatusAwayIfNeeded")