[MM-54434] Use job.Logger to capture ldap logs (#24493)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
afaf41b587
Коммит
aad25be4e1
@@ -330,7 +330,7 @@ func (a *App) CreateOAuthUser(c *request.Context, service string, userData io.Re
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
user, err1 := provider.GetUserFromJSON(userData, tokenUser)
|
||||
user, err1 := provider.GetUserFromJSON(c, userData, tokenUser)
|
||||
if err1 != nil {
|
||||
return nil, model.NewAppError("CreateOAuthUser", "api.user.create_oauth_user.create.app_error", map[string]any{"Service": service}, "", http.StatusInternalServerError).Wrap(err1)
|
||||
}
|
||||
@@ -357,7 +357,7 @@ func (a *App) CreateOAuthUser(c *request.Context, service string, userData io.Re
|
||||
if userByEmail.AuthService == "" {
|
||||
return nil, model.NewAppError("CreateOAuthUser", "api.user.create_oauth_user.already_attached.app_error", map[string]any{"Service": service, "Auth": model.UserAuthServiceEmail}, "email="+user.Email, http.StatusBadRequest)
|
||||
}
|
||||
if provider.IsSameUser(userByEmail, user) {
|
||||
if provider.IsSameUser(c, userByEmail, user) {
|
||||
if _, err := a.Srv().Store().User().UpdateAuthData(userByEmail.Id, user.AuthService, user.AuthData, "", false); err != nil {
|
||||
// if the user is not updated, write a warning to the log, but don't prevent user login
|
||||
c.Logger().Warn("Error attempting to update user AuthData", mlog.Err(err))
|
||||
@@ -1066,7 +1066,7 @@ func (a *App) UpdateUserAsUser(c request.CTX, user *model.User, asAdmin bool) (*
|
||||
// CheckProviderAttributes returns the empty string if the patch can be applied without
|
||||
// overriding attributes set by the user's login provider; otherwise, the name of the offending
|
||||
// field is returned.
|
||||
func (a *App) CheckProviderAttributes(user *model.User, patch *model.UserPatch) string {
|
||||
func (a *App) CheckProviderAttributes(c *request.Context, user *model.User, patch *model.UserPatch) string {
|
||||
tryingToChange := func(userValue *string, patchValue *string) bool {
|
||||
return patchValue != nil && *patchValue != *userValue
|
||||
}
|
||||
@@ -1082,9 +1082,9 @@ func (a *App) CheckProviderAttributes(user *model.User, patch *model.UserPatch)
|
||||
conflictField := ""
|
||||
if a.Ldap() != nil &&
|
||||
(user.IsLDAPUser() || (user.IsSAMLUser() && *SamlSettings.EnableSyncWithLdap)) {
|
||||
conflictField = a.Ldap().CheckProviderAttributes(LdapSettings, user, patch)
|
||||
conflictField = a.Ldap().CheckProviderAttributes(c, LdapSettings, user, patch)
|
||||
} else if a.Saml() != nil && user.IsSAMLUser() {
|
||||
conflictField = a.Saml().CheckProviderAttributes(SamlSettings, user, patch)
|
||||
conflictField = a.Saml().CheckProviderAttributes(c, SamlSettings, user, patch)
|
||||
} else if user.IsOAuthUser() {
|
||||
if tryingToChange(&user.FirstName, patch.FirstName) || tryingToChange(&user.LastName, patch.LastName) {
|
||||
conflictField = "full name"
|
||||
@@ -2101,8 +2101,8 @@ func (a *App) AutocompleteUsersInTeam(teamID string, term string, options *model
|
||||
return autocomplete, nil
|
||||
}
|
||||
|
||||
func (a *App) UpdateOAuthUserAttrs(userData io.Reader, user *model.User, provider einterfaces.OAuthProvider, service string, tokenUser *model.User) *model.AppError {
|
||||
oauthUser, err1 := provider.GetUserFromJSON(userData, tokenUser)
|
||||
func (a *App) UpdateOAuthUserAttrs(c *request.Context, userData io.Reader, user *model.User, provider einterfaces.OAuthProvider, service string, tokenUser *model.User) *model.AppError {
|
||||
oauthUser, err1 := provider.GetUserFromJSON(c, userData, tokenUser)
|
||||
if err1 != nil {
|
||||
return model.NewAppError("UpdateOAuthUserAttrs", "api.user.update_oauth_user_attrs.get_user.app_error", map[string]any{"Service": service}, "", http.StatusBadRequest).Wrap(err1)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user