Commit be099306 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'rs-ee-only-routes-2' into 'master'

CE-EE parity for routes

See merge request gitlab-org/gitlab-ce!29994
parents fa54a486 8e42fe94
...@@ -27,10 +27,16 @@ Rails.application.routes.draw do ...@@ -27,10 +27,16 @@ Rails.application.routes.draw do
authorizations: 'oauth/authorizations' authorizations: 'oauth/authorizations'
end end
# This is here so we can "reserve" the path for the Jira integration in GitLab EE # This prefixless path is required because Jira gets confused if we set it up with a path
# Having a non-existent controller here does not affect the scope in any way since all possible routes # More information: https://gitlab.com/gitlab-org/gitlab-ee/issues/6752
# get a 404 proc returned. It is written in this way to minimize merge conflicts with EE
scope path: '/login/oauth', controller: 'oauth/jira/authorizations', as: :oauth_jira do scope path: '/login/oauth', controller: 'oauth/jira/authorizations', as: :oauth_jira do
Gitlab.ee do
get :authorize, action: :new
get :callback
post :access_token
end
# This helps minimize merge conflicts with CE for this scope block
match '*all', via: [:get, :post], to: proc { [404, {}, ['']] } match '*all', via: [:get, :post], to: proc { [404, {}, ['']] }
end end
...@@ -45,6 +51,10 @@ Rails.application.routes.draw do ...@@ -45,6 +51,10 @@ Rails.application.routes.draw do
get '/autocomplete/award_emojis' => 'autocomplete#award_emojis' get '/autocomplete/award_emojis' => 'autocomplete#award_emojis'
get '/autocomplete/merge_request_target_branches' => 'autocomplete#merge_request_target_branches' get '/autocomplete/merge_request_target_branches' => 'autocomplete#merge_request_target_branches'
Gitlab.ee do
get '/autocomplete/project_groups' => 'autocomplete#project_groups'
end
# Search # Search
get 'search' => 'search#show' get 'search' => 'search#show'
get 'search/autocomplete' => 'search#autocomplete', as: :search_autocomplete get 'search/autocomplete' => 'search#autocomplete', as: :search_autocomplete
...@@ -73,6 +83,11 @@ Rails.application.routes.draw do ...@@ -73,6 +83,11 @@ Rails.application.routes.draw do
end end
resources :issues, module: :boards, only: [:index, :update] resources :issues, module: :boards, only: [:index, :update]
Gitlab.ee do
resources :users, module: :boards, only: [:index]
resources :milestones, module: :boards, only: [:index]
end
end end
get 'acme-challenge/' => 'acme_challenges#show' get 'acme-challenge/' => 'acme_challenges#show'
...@@ -86,6 +101,11 @@ Rails.application.routes.draw do ...@@ -86,6 +101,11 @@ Rails.application.routes.draw do
draw :operations draw :operations
draw :instance_statistics draw :instance_statistics
Gitlab.ee do
draw :smartcard
draw :jira_connect
end
if ENV['GITLAB_ENABLE_CHAOS_ENDPOINTS'] if ENV['GITLAB_ENABLE_CHAOS_ENDPOINTS']
get '/chaos/leakmem' => 'chaos#leakmem' get '/chaos/leakmem' => 'chaos#leakmem'
get '/chaos/cpuspin' => 'chaos#cpuspin' get '/chaos/cpuspin' => 'chaos#cpuspin'
...@@ -102,6 +122,10 @@ Rails.application.routes.draw do ...@@ -102,6 +122,10 @@ Rails.application.routes.draw do
end end
member do member do
Gitlab.ee do
get :metrics, format: :json
end
scope :applications do scope :applications do
post '/:application', to: 'clusters/applications#create', as: :install_applications post '/:application', to: 'clusters/applications#create', as: :install_applications
patch '/:application', to: 'clusters/applications#update', as: :update_applications patch '/:application', to: 'clusters/applications#update', as: :update_applications
......
...@@ -3,5 +3,5 @@ constraints(::Constraints::FeatureConstrainer.new(:graphql, default_enabled: tru ...@@ -3,5 +3,5 @@ constraints(::Constraints::FeatureConstrainer.new(:graphql, default_enabled: tru
mount GraphiQL::Rails::Engine, at: '/-/graphql-explorer', graphql_path: '/api/graphql' mount GraphiQL::Rails::Engine, at: '/-/graphql-explorer', graphql_path: '/api/graphql'
end end
API::API.logger Rails.logger ::API::API.logger Rails.logger
mount API::API => '/' mount ::API::API => '/'
...@@ -40,6 +40,15 @@ resource :profile, only: [:show, :update] do ...@@ -40,6 +40,15 @@ resource :profile, only: [:show, :update] do
put :resend_confirmation_instructions put :resend_confirmation_instructions
end end
end end
Gitlab.ee do
resource :slack, only: [:edit] do
member do
get :slack_link
end
end
end
resources :chat_names, only: [:index, :new, :create, :destroy] do resources :chat_names, only: [:index, :new, :create, :destroy] do
collection do collection do
delete :deny delete :deny
...@@ -63,5 +72,10 @@ resource :profile, only: [:show, :update] do ...@@ -63,5 +72,10 @@ resource :profile, only: [:show, :update] do
end end
resources :u2f_registrations, only: [:destroy] resources :u2f_registrations, only: [:destroy]
Gitlab.ee do
resources :pipeline_quota, only: [:index]
resources :billings, only: [:index]
end
end end
end end
...@@ -79,12 +79,22 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -79,12 +79,22 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
resource :operations, only: [:show, :update] resource :operations, only: [:show, :update]
resource :integrations, only: [:show] resource :integrations, only: [:show]
Gitlab.ee do
resource :slack, only: [:destroy, :edit, :update] do
get :slack_auth
end
end
resource :repository, only: [:show], controller: :repository do resource :repository, only: [:show], controller: :repository do
post :create_deploy_token, path: 'deploy_token/create' post :create_deploy_token, path: 'deploy_token/create'
post :cleanup post :cleanup
end end
end end
Gitlab.ee do
resources :feature_flags
end
resources :autocomplete_sources, only: [] do resources :autocomplete_sources, only: [] do
collection do collection do
get 'members' get 'members'
...@@ -203,8 +213,18 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -203,8 +213,18 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
resource :mattermost, only: [:new, :create] resource :mattermost, only: [:new, :create]
namespace :prometheus do namespace :prometheus do
resources :metrics, constraints: { id: %r{[^\/]+} }, only: [] do resources :metrics, constraints: { id: %r{[^\/]+} }, only: [:index, :new, :create, :edit, :update, :destroy] do
get :active_common, on: :collection get :active_common, on: :collection
Gitlab.ee do
post :validate_query, on: :collection
end
end
Gitlab.ee do
resources :alerts, constraints: { id: /\d+/ }, only: [:index, :create, :show, :update, :destroy] do
post :notify, on: :collection
end
end end
end end
...@@ -216,6 +236,15 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -216,6 +236,15 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get :pipeline_status get :pipeline_status
get :ci_environments_status get :ci_environments_status
post :toggle_subscription post :toggle_subscription
Gitlab.ee do
get :approvals
post :approvals, action: :approve
delete :approvals, action: :unapprove
post :rebase
end
post :remove_wip post :remove_wip
post :assign_related_issues post :assign_related_issues
get :discussions, format: :json get :discussions, format: :json
...@@ -248,6 +277,21 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -248,6 +277,21 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
post :bulk_update post :bulk_update
end end
Gitlab.ee do
resources :approvers, only: :destroy
delete 'approvers', to: 'approvers#destroy_via_user_id', as: :approver_via_user_id
resources :approver_groups, only: :destroy
scope module: :merge_requests do
resources :drafts, only: [:index, :update, :create, :destroy] do
collection do
post :publish
delete :discard
end
end
end
end
resources :discussions, only: [:show], constraints: { id: /\h{40}/ } do resources :discussions, only: [:show], constraints: { id: /\h{40}/ } do
member do member do
post :resolve post :resolve
...@@ -278,6 +322,17 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -278,6 +322,17 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end end
end end
Gitlab.ee do
resources :path_locks, only: [:index, :destroy] do
collection do
post :toggle
end
end
get '/service_desk' => 'service_desk#show', as: :service_desk
put '/service_desk' => 'service_desk#update', as: :service_desk_refresh
end
resource :variables, only: [:show, :update] resource :variables, only: [:show, :update]
resources :triggers, only: [:index, :create, :edit, :update, :destroy] do resources :triggers, only: [:index, :create, :edit, :update, :destroy] do
...@@ -293,6 +348,10 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -293,6 +348,10 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end end
end end
Gitlab.ee do
resources :push_rules, constraints: { id: /\d+/ }, only: [:update]
end
resources :pipelines, only: [:index, :new, :create, :show] do resources :pipelines, only: [:index, :new, :create, :show] do
collection do collection do
resource :pipelines_settings, path: 'settings', only: [:show, :update] resource :pipelines_settings, path: 'settings', only: [:show, :update]
...@@ -307,6 +366,11 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -307,6 +366,11 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get :builds get :builds
get :failures get :failures
get :status get :status
Gitlab.ee do
get :security
get :licenses
end
end end
member do member do
...@@ -335,6 +399,10 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -335,6 +399,10 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get '/terminal.ws/authorize', to: 'environments#terminal_websocket_authorize', constraints: { format: nil } get '/terminal.ws/authorize', to: 'environments#terminal_websocket_authorize', constraints: { format: nil }
get '/prometheus/api/v1/*proxy_path', to: 'environments/prometheus_api#proxy', as: :prometheus_api get '/prometheus/api/v1/*proxy_path', to: 'environments/prometheus_api#proxy', as: :prometheus_api
Gitlab.ee do
get :logs
end
end end
collection do collection do
...@@ -351,6 +419,14 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -351,6 +419,14 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end end
end end
Gitlab.ee do
resources :protected_environments, only: [:create, :update, :destroy], constraints: { id: /\d+/ } do
collection do
get 'search'
end
end
end
resource :cycle_analytics, only: [:show] resource :cycle_analytics, only: [:show]
namespace :cycle_analytics do namespace :cycle_analytics do
...@@ -403,6 +479,14 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -403,6 +479,14 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end end
end end
Gitlab.ee do
namespace :security do
resource :dashboard, only: [:show], controller: :dashboard
end
resources :vulnerability_feedback, only: [:index, :create, :update, :destroy], constraints: { id: /\d+/ }
end
get :issues, to: 'issues#calendar', constraints: lambda { |req| req.format == :ics } get :issues, to: 'issues#calendar', constraints: lambda { |req| req.format == :ics }
resources :issues, concerns: :awardable, constraints: { id: /\d+/ } do resources :issues, concerns: :awardable, constraints: { id: /\d+/ } do
...@@ -421,6 +505,15 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -421,6 +505,15 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
collection do collection do
post :bulk_update post :bulk_update
post :import_csv post :import_csv
Gitlab.ee do
post :export_csv
get :service_desk
end
end
Gitlab.ee do
resources :issue_links, only: [:index, :create, :destroy], as: 'links', path: 'links'
end end
end end
...@@ -455,6 +548,11 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -455,6 +548,11 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end end
end end
Gitlab.ee do
resources :approvers, only: :destroy
resources :approver_groups, only: :destroy
end
resources :runner_projects, only: [:create, :destroy] resources :runner_projects, only: [:create, :destroy]
resources :badges, only: [:index] do resources :badges, only: [:index] do
collection do collection do
...@@ -469,6 +567,10 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -469,6 +567,10 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end end
end end
Gitlab.ee do
resources :audit_events, only: [:index]
end
resources :error_tracking, only: [:index], controller: :error_tracking do resources :error_tracking, only: [:index], controller: :error_tracking do
collection do collection do
post :list_projects post :list_projects
...@@ -479,6 +581,10 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -479,6 +581,10 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
# its preferable to keep it below all other project routes # its preferable to keep it below all other project routes
draw :wiki draw :wiki
draw :repository draw :repository
Gitlab.ee do
resources :managed_licenses, only: [:index, :show, :new, :create, :edit, :update, :destroy]
end
end end
resources(:projects, resources(:projects,
......
...@@ -58,7 +58,7 @@ scope format: false do ...@@ -58,7 +58,7 @@ scope format: false do
resource :release, controller: 'tags/releases', only: [:edit, :update] resource :release, controller: 'tags/releases', only: [:edit, :update]
end end
resources :protected_branches, only: [:index, :show, :create, :update, :destroy] resources :protected_branches, only: [:index, :show, :create, :update, :destroy, :patch], constraints: { id: Gitlab::PathRegex.git_reference_regex }
resources :protected_tags, only: [:index, :show, :create, :update, :destroy] resources :protected_tags, only: [:index, :show, :create, :update, :destroy]
end end
......
Gitlab.ee do
get 'unsubscribes/:email', to: 'unsubscribes#show', as: :unsubscribe
post 'unsubscribes/:email', to: 'unsubscribes#create'
end
# Allows individual providers to be directed to a chosen controller # Allows individual providers to be directed to a chosen controller
# Call from inside devise_scope # Call from inside devise_scope
def override_omniauth(provider, controller, path_prefix = '/users/auth') def override_omniauth(provider, controller, path_prefix = '/users/auth')
...@@ -25,6 +30,17 @@ devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, ...@@ -25,6 +30,17 @@ devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks,
devise_scope :user do devise_scope :user do
get '/users/auth/:provider/omniauth_error' => 'omniauth_callbacks#omniauth_error', as: :omniauth_error get '/users/auth/:provider/omniauth_error' => 'omniauth_callbacks#omniauth_error', as: :omniauth_error
get '/users/almost_there' => 'confirmations#almost_there' get '/users/almost_there' => 'confirmations#almost_there'
Gitlab.ee do
get '/users/auth/kerberos_spnego/negotiate' => 'omniauth_kerberos_spnego#negotiate'
end
end
scope '-/users', module: :users do
resources :terms, only: [:index] do
post :accept, on: :member
post :decline, on: :member
end
end end
scope '-/users', module: :users do scope '-/users', module: :users do
......
...@@ -71,6 +71,10 @@ module Gitlab ...@@ -71,6 +71,10 @@ module Gitlab
end end
end end
def self.ee
yield if ee?
end
def self.http_proxy_env? def self.http_proxy_env?
HTTP_PROXY_ENV_VARS.any? { |name| ENV[name] } HTTP_PROXY_ENV_VARS.any? { |name| ENV[name] }
end end
......
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