[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
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a2700684f1
Коммит
5ce5ea93f4
12
api4/user.go
12
api4/user.go
@@ -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
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user