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
module Middleware
class ReadonlyGeo
DISALLOWED_METHODS = %w(POST PATCH PUT DELETE)
WHITELISTED = %w(api/v3/internal api/v3/geo/refresh_projects)
def initialize(app)
@app = app
......@@ -49,8 +50,7 @@ module Gitlab
end
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
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