diff options
author | Jesse Hallam <jesse.hallam@gmail.com> | 2018-06-07 14:19:19 -0400 |
---|---|---|
committer | Carlos Tadeu Panato Junior <ctadeu@gmail.com> | 2018-06-07 20:19:19 +0200 |
commit | 927b11f6e247746f0f5ceeae592b9c525e3c2f76 (patch) | |
tree | bd2bc4a0911f109b2c7743a1488bab13941da76b /app | |
parent | 1d961b1632d7cac5574f48f447755fbeddbdfa4b (diff) | |
download | chat-927b11f6e247746f0f5ceeae592b9c525e3c2f76.tar.gz chat-927b11f6e247746f0f5ceeae592b9c525e3c2f76.tar.bz2 chat-927b11f6e247746f0f5ceeae592b9c525e3c2f76.zip |
MM-10803: remove premature user sanitization on deactivation (#8926)
* remove unused UpdateNonSSOUserActive
* MM-10803: stop prematurely sanitizing users on deactivate
This change was preceded by the removal of UpdateNonSSOUserActive to
ensure there are no APIs relying on the sanitized return value.
* MM-10803: test websocket events after UpdateUserActive
Diffstat (limited to 'app')
-rw-r--r-- | app/user.go | 19 | ||||
-rw-r--r-- | app/user_test.go | 18 |
2 files changed, 0 insertions, 37 deletions
diff --git a/app/user.go b/app/user.go index 2325c6338..ccf8dd40e 100644 --- a/app/user.go +++ b/app/user.go @@ -862,22 +862,6 @@ func (a *App) UpdatePasswordAsUser(userId, currentPassword, newPassword string) return a.UpdatePasswordSendEmail(user, newPassword, T("api.user.update_password.menu")) } -func (a *App) UpdateNonSSOUserActive(userId string, active bool) (*model.User, *model.AppError) { - var user *model.User - var err *model.AppError - if user, err = a.GetUser(userId); err != nil { - return nil, err - } - - if user.IsSSOUser() { - err := model.NewAppError("UpdateActive", "api.user.update_active.no_deactivate_sso.app_error", nil, "userId="+user.Id, http.StatusBadRequest) - err.StatusCode = http.StatusBadRequest - return nil, err - } - - return a.UpdateActive(user, active) -} - func (a *App) UpdateActive(user *model.User, active bool) (*model.User, *model.AppError) { if active { user.DeleteAt = 0 @@ -895,9 +879,6 @@ func (a *App) UpdateActive(user *model.User, active bool) (*model.User, *model.A } ruser := result.Data.([2]*model.User)[0] - options := a.Config().GetSanitizeOptions() - options["passwordupdate"] = false - ruser.Sanitize(options) if !active { a.SetStatusOffline(ruser.Id, false) diff --git a/app/user_test.go b/app/user_test.go index f0e026fa9..b557d296b 100644 --- a/app/user_test.go +++ b/app/user_test.go @@ -96,24 +96,6 @@ func TestCreateOAuthUser(t *testing.T) { } } -func TestDeactivateSSOUser(t *testing.T) { - th := Setup().InitBasic() - defer th.TearDown() - - r := rand.New(rand.NewSource(time.Now().UnixNano())) - glUser := oauthgitlab.GitLabUser{Id: int64(r.Intn(1000)) + 1, Username: "o" + model.NewId(), Email: model.NewId() + "@simulator.amazonses.com", Name: "Joram Wilander"} - - json := glUser.ToJson() - user, err := th.App.CreateOAuthUser(model.USER_AUTH_SERVICE_GITLAB, strings.NewReader(json), th.BasicTeam.Id) - if err != nil { - t.Fatal(err) - } - defer th.App.PermanentDeleteUser(user) - - _, err = th.App.UpdateNonSSOUserActive(user.Id, false) - assert.Equal(t, "api.user.update_active.no_deactivate_sso.app_error", err.Id) -} - func TestCreateProfileImage(t *testing.T) { b, err := CreateProfileImage("Corey Hulen", "eo1zkdr96pdj98pjmq8zy35wba", "luximbi.ttf") if err != nil { |