Check whether self-deactivation is enabled in delete handler (#10300)

Этот коммит содержится в:
Daniel Schalla
2019-02-20 16:56:26 +01:00
коммит произвёл GitHub
родитель f046163a12
Коммит 166ab15f38
2 изменённых файлов: 21 добавлений и 0 удалений

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

@@ -791,6 +791,12 @@ func deleteUser(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
// if EnableUserDeactivation flag is disabled the user cannot deactivate himself.
if c.Params.UserId == c.App.Session.UserId && !*c.App.Config().TeamSettings.EnableUserDeactivation && !c.App.SessionHasPermissionTo(c.App.Session, model.PERMISSION_MANAGE_SYSTEM) {
c.Err = model.NewAppError("deleteUser", "api.user.update_active.not_enable.app_error", nil, "userId="+c.Params.UserId, http.StatusUnauthorized)
return
}
user, err := c.App.GetUser(userId)
if err != nil {
c.Err = err