Commit 9b817e66 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Small improvement to ReadOnly middleware (make whitelist a constant)

parent ec7549a3
...@@ -2,6 +2,7 @@ module Gitlab ...@@ -2,6 +2,7 @@ module Gitlab
module Middleware module Middleware
class ReadonlyGeo class ReadonlyGeo
DISALLOWED_METHODS = %w(POST PATCH PUT DELETE) DISALLOWED_METHODS = %w(POST PATCH PUT DELETE)
WHITELISTED = %w(api/v3/internal api/v3/geo/refresh_projects)
def initialize(app) def initialize(app)
@app = app @app = app
...@@ -49,8 +50,7 @@ module Gitlab ...@@ -49,8 +50,7 @@ module Gitlab
end end
def whitelisted_routes def whitelisted_routes
whitelisted = %w(api/v3/internal api/v3/geo/refresh_projects) logout_route || WHITELISTED.any? { |path| @request.path.include?(path) }
logout_route || whitelisted.any? { |path| @request.path.include?(path) }
end end
def logout_route def logout_route
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment