Apply suggestions from code review

Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
techknowlogick 2024-04-01 23:09:19 -04:00 committed by GitHub
parent 21ded9aad7
commit 189fd9ea1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View File

@ -898,7 +898,8 @@ LEVEL = Info
;VALID_SITE_URL_SCHEMES=http,https
;; The maximum number of users allowed to exist before creation is disabled.
;; This is not a security prevention measure.
;; Note, Admins will also be unable to create new users via the dashboard
;; Note, Admins will also be unable to create new users via the dashboard when the limit has been reached
;; `-1` means no limit
;MAX_USER_CREATE_LIMIT=-1

View File

@ -686,7 +686,7 @@ And the following unique queues:
The user's email will be replaced with a concatenation of the user name in lower case, "@" and NO_REPLY_ADDRESS.
- `USER_DELETE_WITH_COMMENTS_MAX_TIME`: **0** Minimum amount of time a user must exist before comments are kept when the user is deleted.
- `VALID_SITE_URL_SCHEMES`: **http, https**: Valid site url schemes for user profiles
- `MAX_USER_CREATE_LIMIT`: **-1**: The maximum number of users allowed to exist before creation is disabled. Note: This also prevents admins from creating new users. `-1` means no, limit.
- `MAX_USER_CREATE_LIMIT`: **-1**: The maximum number of users allowed to exist before creation is disabled. Note: This also prevents admins from creating new users. `-1` means no limit.
### Service - Explore (`service.explore`)

View File

@ -736,7 +736,7 @@ func createUser(ctx context.Context, u *User, createdByAdmin bool, overwriteDefa
func HitCreationLimit(ctx context.Context) bool {
// don't bother calling DB if limit not set
if setting.Service.MaxUserCreationLimit == -1 ||
if setting.Service.MaxUserCreationLimit < 0 ||
int64(setting.Service.MaxUserCreationLimit) < CountUsers(ctx, &CountUserFilter{}) {
return false
}