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
33def370
Commit
33def370
authored
Mar 25, 2020
by
nicolasdular
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accept namespace limit in application settings
parent
3b030e56
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
0 deletions
+27
-0
app/controllers/admin/application_settings_controller.rb
app/controllers/admin/application_settings_controller.rb
+1
-0
app/models/application_setting.rb
app/models/application_setting.rb
+4
-0
app/models/application_setting_implementation.rb
app/models/application_setting_implementation.rb
+1
-0
spec/controllers/admin/application_settings_controller_spec.rb
...controllers/admin/application_settings_controller_spec.rb
+16
-0
spec/models/application_setting_spec.rb
spec/models/application_setting_spec.rb
+5
-0
No files found.
app/controllers/admin/application_settings_controller.rb
View file @
33def370
...
...
@@ -218,6 +218,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:lets_encrypt_terms_of_service_accepted
,
:domain_blacklist_file
,
:raw_blob_request_limit
,
:namespace_storage_size_limit
,
disabled_oauth_sign_in_sources:
[],
import_sources:
[],
repository_storages:
[],
...
...
app/models/application_setting.rb
View file @
33def370
...
...
@@ -337,6 +337,10 @@ class ApplicationSetting < ApplicationRecord
length:
{
maximum:
255
},
allow_blank:
true
validates
:namespace_storage_size_limit
,
presence:
true
,
numericality:
{
only_integer:
true
,
greater_than_or_equal_to:
0
}
attr_encrypted
:asset_proxy_secret_key
,
mode: :per_attribute_iv
,
key:
Settings
.
attr_encrypted_db_key_base_truncated
,
...
...
app/models/application_setting_implementation.rb
View file @
33def370
...
...
@@ -111,6 +111,7 @@ module ApplicationSettingImplementation
sourcegraph_url:
nil
,
sourcegraph_public_only:
true
,
minimum_password_length:
DEFAULT_MINIMUM_PASSWORD_LENGTH
,
namespace_storage_size_limit:
0
,
terminal_max_session_time:
0
,
throttle_authenticated_api_enabled:
false
,
throttle_authenticated_api_period_in_seconds:
3600
,
...
...
spec/controllers/admin/application_settings_controller_spec.rb
View file @
33def370
...
...
@@ -104,6 +104,22 @@ describe Admin::ApplicationSettingsController do
expect
(
ApplicationSetting
.
current
.
minimum_password_length
).
to
eq
(
10
)
end
it
'updates namespace_storage_size_limit setting'
do
put
:update
,
params:
{
application_setting:
{
namespace_storage_size_limit:
'100'
}
}
expect
(
response
).
to
redirect_to
(
general_admin_application_settings_path
)
expect
(
response
).
to
set_flash
[
:notice
].
to
(
'Application settings saved successfully'
)
expect
(
ApplicationSetting
.
current
.
namespace_storage_size_limit
).
to
eq
(
100
)
end
it
'does not accept an invalid namespace_storage_size_limit'
do
put
:update
,
params:
{
application_setting:
{
namespace_storage_size_limit:
'-100'
}
}
expect
(
response
).
to
render_template
(
:general
)
expect
(
assigns
(
:application_setting
).
errors
[
:namespace_storage_size_limit
]).
to
be_present
expect
(
ApplicationSetting
.
current
.
namespace_storage_size_limit
).
not_to
eq
(
-
100
)
end
context
'external policy classification settings'
do
let
(
:settings
)
do
{
...
...
spec/models/application_setting_spec.rb
View file @
33def370
...
...
@@ -82,6 +82,11 @@ describe ApplicationSetting do
it
{
is_expected
.
not_to
allow_value
(
'abc'
).
for
(
:minimum_password_length
)
}
it
{
is_expected
.
to
allow_value
(
10
).
for
(
:minimum_password_length
)
}
it
{
is_expected
.
to
allow_value
(
0
).
for
(
:namespace_storage_size_limit
)
}
it
{
is_expected
.
to
allow_value
(
1
).
for
(
:namespace_storage_size_limit
)
}
it
{
is_expected
.
not_to
allow_value
(
nil
).
for
(
:namespace_storage_size_limit
)
}
it
{
is_expected
.
not_to
allow_value
(
-
1
).
for
(
:namespace_storage_size_limit
)
}
context
'grafana_url validations'
do
before
do
subject
.
instance_variable_set
(
:@parsed_grafana_url
,
nil
)
...
...
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