mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Added count exceeded warning (#25817)
* Added count exceeded warning * lint fix * Updated message * Update server/channels/app/user.go Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com> * added check for activating user * Updated copy --------- Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
This commit is contained in:
@@ -318,6 +318,17 @@ func (a *App) createUserOrGuest(c request.CTX, user *model.User, guest bool) (*m
|
||||
}(ruser.Id)
|
||||
}
|
||||
|
||||
userLimits, appErr := a.GetUserLimits()
|
||||
if appErr != nil {
|
||||
// we don't want to break the create user flow just because of this.
|
||||
// So, we log the error, not return
|
||||
mlog.Error("Error fetching user limits in createUserOrGuest", mlog.Err(appErr))
|
||||
} else {
|
||||
if userLimits.ActiveUserCount > userLimits.MaxUsersLimit {
|
||||
mlog.Warn("ERROR_USER_LIMITS_EXCEEDED: Created user exceeds the total activated users limit.", mlog.Int("user_limit", userLimits.MaxUsersLimit))
|
||||
}
|
||||
}
|
||||
|
||||
return ruser, nil
|
||||
}
|
||||
|
||||
@@ -1013,6 +1024,17 @@ func (a *App) UpdateActive(c request.CTX, user *model.User, active bool) (*model
|
||||
})
|
||||
}
|
||||
|
||||
if active {
|
||||
userLimits, appErr := a.GetUserLimits()
|
||||
if appErr != nil {
|
||||
mlog.Error("Error fetching user limits in UpdateActive", mlog.Err(appErr))
|
||||
} else {
|
||||
if userLimits.ActiveUserCount > userLimits.MaxUsersLimit {
|
||||
mlog.Warn("ERROR_USER_LIMITS_EXCEEDED: Activated user exceeds the total active user limit.", mlog.Int("user_limit", userLimits.MaxUsersLimit))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ruser, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user