[MM-36198] - Activating a user in System Console does not respect cloud user limits (#17719)

* [MM-36198] - Activating a user in System Console does not respect cloud user limits

* feedback impl

* improve error check
Этот коммит содержится в:
Allan Guwatudde
2021-06-07 17:38:33 +03:00
коммит произвёл GitHub
родитель a2700684f1
Коммит 5ce5ea93f4
7 изменённых файлов: 157 добавлений и 21 удалений

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

@@ -1377,6 +1377,18 @@ func updateUserActive(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
// if non cloud instances, isOverLimit is false and no error
isAtLimit, err := c.App.CheckCloudAccountAtLimit()
if err != nil {
c.Err = model.NewAppError("updateUserActive", "api.user.update_active.cloud_at_limit_check_error", nil, "userId="+c.Params.UserId, http.StatusInternalServerError)
return
}
if active && isAtLimit {
c.Err = model.NewAppError("updateUserActive", "api.user.update_active.cloud_at_or_over_limit_check_overcapacity", nil, "userId="+c.Params.UserId, http.StatusBadRequest)
return
}
if _, err = c.App.UpdateActive(c.AppContext, user, active); err != nil {
c.Err = err
}