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
352abacf
Commit
352abacf
authored
Jan 23, 2020
by
Douglas Barbosa Alexandre
Committed by
Michael Kozono
Jan 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow users to sign-out on a read-only instance
parent
dec0c7a9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
1 deletion
+29
-1
changelogs/unreleased/198289-unable-to-sign-out-from-secondary-geo-node.yml
...sed/198289-unable-to-sign-out-from-secondary-geo-node.yml
+5
-0
lib/gitlab/middleware/read_only/controller.rb
lib/gitlab/middleware/read_only/controller.rb
+12
-1
spec/features/users/logout_spec.rb
spec/features/users/logout_spec.rb
+12
-0
No files found.
changelogs/unreleased/198289-unable-to-sign-out-from-secondary-geo-node.yml
0 → 100644
View file @
352abacf
---
title
:
Allow users to sign out on a read-only instance
merge_request
:
23545
author
:
type
:
fixed
lib/gitlab/middleware/read_only/controller.rb
View file @
352abacf
...
...
@@ -24,6 +24,10 @@ module Gitlab
'projects/compare'
=>
%w{create}
}.
freeze
WHITELISTED_LOGOUT_ROUTES
=
{
'sessions'
=>
%w{destroy}
}.
freeze
GRAPHQL_URL
=
'/api/graphql'
def
initialize
(
app
,
env
)
...
...
@@ -85,7 +89,7 @@ module Gitlab
# Overridden in EE module
def
whitelisted_routes
grack_route?
||
internal_route?
||
lfs_route?
||
compare_git_revisions_route?
||
sidekiq_route?
||
graphql_query?
grack_route?
||
internal_route?
||
lfs_route?
||
compare_git_revisions_route?
||
sidekiq_route?
||
logout_route?
||
graphql_query?
end
def
grack_route?
...
...
@@ -118,6 +122,13 @@ module Gitlab
WHITELISTED_GIT_LFS_ROUTES
[
route_hash
[
:controller
]]
&
.
include?
(
route_hash
[
:action
])
end
def
logout_route?
# Calling route_hash may be expensive. Only do it if we think there's a possible match
return
false
unless
request
.
post?
&&
request
.
path
.
end_with?
(
'/users/sign_out'
)
WHITELISTED_LOGOUT_ROUTES
[
route_hash
[
:controller
]]
&
.
include?
(
route_hash
[
:action
])
end
def
sidekiq_route?
request
.
path
.
start_with?
(
"
#{
relative_url
}
/admin/sidekiq"
)
end
...
...
spec/features/users/logout_spec.rb
View file @
352abacf
...
...
@@ -21,4 +21,16 @@ describe 'Logout/Sign out', :js do
expect
(
page
).
not_to
have_selector
(
'.flash-notice'
)
end
context
'on a read-only instance'
do
before
do
allow
(
Gitlab
::
Database
).
to
receive
(
:read_only?
).
and_return
(
true
)
end
it
'sign out redirects to sign in page'
do
gitlab_sign_out
expect
(
current_path
).
to
eq
new_user_session_path
end
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