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
ca389e1f
Commit
ca389e1f
authored
Feb 18, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for Geo API and whitelisted it on the readonly middleware
parent
29de1916
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
lib/api/api.rb
lib/api/api.rb
+1
-0
lib/api/geo.rb
lib/api/geo.rb
+2
-3
lib/gitlab/middleware/readonly_geo.rb
lib/gitlab/middleware/readonly_geo.rb
+5
-1
No files found.
lib/api/api.rb
View file @
ca389e1f
...
...
@@ -27,6 +27,7 @@ module API
helpers
Helpers
mount
Geo
mount
Groups
mount
GroupMembers
mount
Users
...
...
lib/api/geo.rb
View file @
ca389e1f
...
...
@@ -10,9 +10,8 @@ module API
# Example request:
# POST /refresh_projects
post
'refresh_projects'
do
attrs
=
attributes_for_keys
[
:projects
]
Geo
::
ScheduleRepoUpdateService
.
new
(
attrs
[
:projects
]).
execute
required_attributes!
[
:projects
]
::
Geo
::
ScheduleRepoUpdateService
.
new
(
params
[
:projects
]).
execute
end
end
end
...
...
lib/gitlab/middleware/readonly_geo.rb
View file @
ca389e1f
...
...
@@ -25,7 +25,7 @@ module Gitlab
private
def
disallowed_request?
DISALLOWED_METHODS
.
include?
(
@env
[
'REQUEST_METHOD'
])
&&
!
logout_route
DISALLOWED_METHODS
.
include?
(
@env
[
'REQUEST_METHOD'
])
&&
!
whitelisted_routes
end
def
rack_flash
...
...
@@ -48,6 +48,10 @@ module Gitlab
@route_hash
||=
Rails
.
application
.
routes
.
recognize_path
(
request
.
url
,
{
method:
request
.
request_method
})
rescue
{}
end
def
whitelisted_routes
logout_route
||
@request
.
path
.
include?
(
'api/v3/geo/refresh_projects'
)
end
def
logout_route
route_hash
[
:controller
]
==
'sessions'
&&
route_hash
[
:action
]
==
'destroy'
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