Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f7e0c562
Commit
f7e0c562
authored
Oct 30, 2020
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix validations for user cap setting
parent
d99701be
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
ee/app/models/ee/application_setting.rb
ee/app/models/ee/application_setting.rb
+8
-4
ee/spec/models/application_setting_spec.rb
ee/spec/models/application_setting_spec.rb
+3
-0
No files found.
ee/app/models/ee/application_setting.rb
View file @
f7e0c562
...
...
@@ -95,11 +95,15 @@ module EE
validate
:allowed_frameworks
,
if: :compliance_frameworks_changed?
validates
:new_user_signups_cap
,
numericality:
{
only_integer:
true
,
allow_nil:
true
,
greater_than:
0
}
allow_blank:
true
,
numericality:
{
only_integer:
true
,
greater_than:
0
}
validates
:new_user_signups_cap
,
numericality:
{
less_than_or_equal_to:
proc
{
License
.
current
&
.
restricted_user_count
}
},
allow_blank:
true
,
numericality:
{
only_integer:
true
,
greater_than:
0
,
less_than_or_equal_to:
proc
{
License
.
current
&
.
restricted_user_count
}
},
if:
proc
{
License
.
current
&
.
restricted_user_count?
}
after_commit
:update_personal_access_tokens_lifetime
,
if: :saved_change_to_max_personal_access_token_lifetime?
...
...
ee/spec/models/application_setting_spec.rb
View file @
f7e0c562
...
...
@@ -88,6 +88,8 @@ RSpec.describe ApplicationSetting do
it
{
is_expected
.
to
allow_value
(
nil
).
for
(
:new_user_signups_cap
)
}
it
{
is_expected
.
to
allow_value
(
1
).
for
(
:new_user_signups_cap
)
}
it
{
is_expected
.
to
allow_value
(
10
).
for
(
:new_user_signups_cap
)
}
it
{
is_expected
.
to
allow_value
(
""
).
for
(
:new_user_signups_cap
)
}
it
{
is_expected
.
not_to
allow_value
(
"value"
).
for
(
:new_user_signups_cap
)
}
it
{
is_expected
.
not_to
allow_value
(
-
1
).
for
(
:new_user_signups_cap
)
}
it
{
is_expected
.
not_to
allow_value
(
2.5
).
for
(
:new_user_signups_cap
)
}
...
...
@@ -175,6 +177,7 @@ RSpec.describe ApplicationSetting do
it
{
is_expected
.
to
allow_value
(
max_active_user_count
-
1
).
for
(
:new_user_signups_cap
)
}
it
{
is_expected
.
to
allow_value
(
max_active_user_count
).
for
(
:new_user_signups_cap
)
}
it
{
is_expected
.
to
allow_value
(
nil
).
for
(
:new_user_signups_cap
)
}
it
{
is_expected
.
not_to
allow_value
(
max_active_user_count
+
1
).
for
(
:new_user_signups_cap
)
}
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment