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
fcd27f33
Commit
fcd27f33
authored
Jan 08, 2021
by
Aakriti Gupta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow edits to applciation settings in maintenance mode
parent
6bd1be63
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
ee/lib/ee/gitlab/middleware/read_only/controller.rb
ee/lib/ee/gitlab/middleware/read_only/controller.rb
+4
-1
ee/spec/support/shared_examples/lib/gitlab/middleware/maintenance_mode_gitlab_ee_instance_shared_examples.rb
...re/maintenance_mode_gitlab_ee_instance_shared_examples.rb
+16
-1
No files found.
ee/lib/ee/gitlab/middleware/read_only/controller.rb
View file @
fcd27f33
...
...
@@ -51,7 +51,10 @@ module EE
end
def
admin_settings_update?
request
.
path
.
start_with?
(
'/api/v4/application/settings'
)
return
false
if
::
Gitlab
::
Geo
.
secondary?
request
.
path
.
start_with?
(
'/api/v4/application/settings'
,
'/admin/application_settings/general'
)
end
def
geo_node_update_route?
...
...
ee/spec/support/shared_examples/lib/gitlab/middleware/maintenance_mode_gitlab_ee_instance_shared_examples.rb
View file @
fcd27f33
...
...
@@ -15,13 +15,20 @@ RSpec.shared_examples 'write access for a read-only GitLab (EE) instance in main
it_behaves_like
'allowlisted /admin/geo requests'
it
"expects a PUT request to /a
dmin/application_settings/general
to be allowed"
do
it
"expects a PUT request to /a
pi/v4/application/settings
to be allowed"
do
response
=
request
.
send
(
:put
,
"/api/v4/application/settings"
)
expect
(
response
).
not_to
be_redirect
expect
(
subject
).
not_to
disallow_request
end
it
"expects a POST request to /admin/application_settings/general to be allowed"
do
response
=
request
.
send
(
:post
,
"/admin/application_settings/general"
)
expect
(
response
).
not_to
be_redirect
expect
(
subject
).
not_to
disallow_request
end
context
'on Geo secondary'
do
before
do
allow
(
::
Gitlab
::
Geo
).
to
receive
(
:secondary?
).
and_return
(
true
)
...
...
@@ -46,6 +53,7 @@ RSpec.shared_examples 'write access for a read-only GitLab (EE) instance in main
'LFS request to locks create'
|
'/root/rouge.git/info/lfs/locks'
'LFS request to locks unlock'
|
'/root/rouge.git/info/lfs/locks/1/unlock'
'git-receive-pack'
|
'/root/rouge.git/git-receive-pack'
'application settings'
|
'/admin/application_settings/general'
end
with_them
do
...
...
@@ -56,6 +64,13 @@ RSpec.shared_examples 'write access for a read-only GitLab (EE) instance in main
expect
(
subject
).
to
disallow_request
end
end
it
"expects a PUT request to /api/v4/application/settings to not be allowed"
do
response
=
request
.
send
(
:put
,
"/api/v4/application/settings"
)
expect
(
response
).
to
be_redirect
expect
(
subject
).
to
disallow_request
end
end
context
'when not on Geo secondary'
do
...
...
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