[MM-55595] Use annotated logger in search layer (#25468)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5a4dba8809
Коммит
b2ec1ff8ae
@@ -220,7 +220,7 @@ func (a *App) AllowOAuthAppAccessToUser(c request.CTX, userID string, authReques
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
mlog.Warn("error getting oauth redirect uri", mlog.Err(err))
|
||||
c.Logger().Warn("error getting oauth redirect uri", mlog.Err(err))
|
||||
return authRequest.RedirectURI + "?error=server_error&state=" + authRequest.State, nil
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ func (a *App) AllowOAuthAppAccessToUser(c request.CTX, userID string, authReques
|
||||
}
|
||||
|
||||
if nErr := a.Srv().Store().Preference().Save(model.Preferences{authorizedApp}); nErr != nil {
|
||||
mlog.Warn("error saving store preference", mlog.Err(nErr))
|
||||
c.Logger().Warn("error saving store preference", mlog.Err(nErr))
|
||||
return authRequest.RedirectURI + "?error=server_error&state=" + authRequest.State, nil
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ func (a *App) GetOAuthAccessTokenForCodeFlow(c request.CTX, clientId, grantType,
|
||||
|
||||
if authData.IsExpired() {
|
||||
if nErr = a.Srv().Store().OAuth().RemoveAuthData(authData.Code); nErr != nil {
|
||||
mlog.Warn("unable to remove auth data", mlog.Err(nErr))
|
||||
c.Logger().Warn("unable to remove auth data", mlog.Err(nErr))
|
||||
}
|
||||
return nil, model.NewAppError("GetOAuthAccessToken", "api.oauth.get_access_token.expired_code.app_error", nil, "", http.StatusForbidden)
|
||||
}
|
||||
@@ -358,7 +358,7 @@ func (a *App) GetOAuthAccessTokenForCodeFlow(c request.CTX, clientId, grantType,
|
||||
}
|
||||
|
||||
if nErr = a.Srv().Store().OAuth().RemoveAuthData(authData.Code); nErr != nil {
|
||||
mlog.Warn("unable to remove auth data", mlog.Err(nErr))
|
||||
c.Logger().Warn("unable to remove auth data", mlog.Err(nErr))
|
||||
}
|
||||
} else {
|
||||
// When grantType is refresh_token
|
||||
@@ -406,7 +406,7 @@ func (a *App) newSession(c request.CTX, app *model.OAuthApp, user *model.User) (
|
||||
func (a *App) newSessionUpdateToken(c request.CTX, app *model.OAuthApp, accessData *model.AccessData, user *model.User) (*model.AccessResponse, *model.AppError) {
|
||||
// Remove the previous session
|
||||
if err := a.Srv().Store().Session().Remove(accessData.Token); err != nil {
|
||||
mlog.Warn("error removing access data token from session", mlog.Err(err))
|
||||
c.Logger().Warn("error removing access data token from session", mlog.Err(err))
|
||||
}
|
||||
|
||||
session, err := a.newSession(c, app, user)
|
||||
@@ -694,7 +694,7 @@ func (a *App) CompleteSwitchWithOAuth(c request.CTX, service string, userData io
|
||||
|
||||
a.Srv().Go(func() {
|
||||
if err := a.Srv().EmailService.SendSignInChangeEmail(user.Email, strings.Title(service)+" SSO", user.Locale, a.GetSiteURL()); err != nil {
|
||||
mlog.Error("error sending signin change email", mlog.Err(err))
|
||||
c.Logger().Error("error sending signin change email", mlog.Err(err))
|
||||
}
|
||||
})
|
||||
|
||||
@@ -837,7 +837,7 @@ func (a *App) AuthorizeOAuthUser(c request.CTX, w http.ResponseWriter, r *http.R
|
||||
|
||||
appErr = a.DeleteToken(expectedToken)
|
||||
if appErr != nil {
|
||||
mlog.Warn("error deleting token", mlog.Err(appErr))
|
||||
c.Logger().Warn("error deleting token", mlog.Err(appErr))
|
||||
}
|
||||
|
||||
subpath, _ := utils.GetSubpathFromConfig(a.Config())
|
||||
@@ -921,7 +921,7 @@ func (a *App) AuthorizeOAuthUser(c request.CTX, w http.ResponseWriter, r *http.R
|
||||
bodyBytes, _ := io.ReadAll(resp.Body)
|
||||
bodyString := string(bodyBytes)
|
||||
|
||||
mlog.Error("Error getting OAuth user", mlog.Int("response", resp.StatusCode), mlog.String("body_string", bodyString))
|
||||
c.Logger().Error("Error getting OAuth user", mlog.Int("response", resp.StatusCode), mlog.String("body_string", bodyString))
|
||||
|
||||
if service == model.ServiceGitlab && resp.StatusCode == http.StatusForbidden && strings.Contains(bodyString, "Terms of Service") {
|
||||
url, err := url.Parse(*sso.UserAPIEndpoint)
|
||||
|
||||
Ссылка в новой задаче
Block a user