group.rb 5.78 KB
Newer Older
1 2 3 4 5 6 7
# frozen_string_literal: true

constraints(::Constraints::GroupUrlConstrainer.new) do
  scope(path: 'groups/*group_id/-',
        module: :groups,
        as: :group,
        constraints: { group_id: Gitlab::PathRegex.full_namespace_route_regex }) do
Markus Koller's avatar
Markus Koller committed
8 9
    draw :wiki

10 11 12 13
    resources :group_members, only: [], concerns: :access_requestable do
      patch :override, on: :member
    end

14 15
    get '/analytics', to: redirect('groups/%{group_id}/-/contribution_analytics')
    resource :contribution_analytics, only: [:show]
16

17
    namespace :analytics do
18 19 20 21 22 23 24 25 26 27 28 29 30 31
      resource :productivity_analytics, only: :show
      resources :coverage_reports, only: :index
      resource :merge_request_analytics, only: :show
      resource :repository_analytics, only: :show
      resource :cycle_analytics, only: :show, path: 'value_stream_analytics'
      scope module: :cycle_analytics, as: 'cycle_analytics', path: 'value_stream_analytics' do
        resources :stages, only: [:index, :create, :update, :destroy] do
          member do
            get :duration_chart
            get :median
            get :records
          end
        end
        resources :value_streams, only: [:index, :create, :destroy] do
32 33 34 35 36 37 38 39
          resources :stages, only: [:index, :create, :update, :destroy] do
            member do
              get :duration_chart
              get :median
              get :records
            end
          end
        end
40 41
        resource :summary, controller: :summary, only: :show
        get '/time_summary' => 'summary#time_summary'
42
      end
43
      get '/cycle_analytics', to: redirect('-/analytics/value_stream_analytics')
44

45 46 47
      scope :type_of_work do
        resource :tasks_by_type, controller: :tasks_by_type, only: :show do
          get :top_labels
48 49
        end
      end
50
    end
Gosia Ksionek's avatar
Gosia Ksionek committed
51

52 53 54 55 56 57
    resource :ldap, only: [] do
      member do
        put :sync
      end
    end

58 59
    resource :ldap_settings, only: [:update]

60 61
    resource :issues_analytics, only: [:show]

62
    resource :insights, only: [:show], trailing_slash: true do
63 64
      collection do
        post :query
65
        get :embedded
66 67 68
      end
    end

69 70 71 72
    resource :notification_setting, only: [:update]

    resources :ldap_group_links, only: [:index, :create, :destroy]
    resources :audit_events, only: [:index]
73
    resources :usage_quotas, only: [:index]
74

75
    resources :hooks, only: [:index, :create, :edit, :update, :destroy], constraints: { id: /\d+/ } do
76 77 78 79 80 81 82 83
      member do
        post :test
      end
    end

    resources :autocomplete_sources, only: [] do
      collection do
        get 'members'
84 85
        get 'issues'
        get 'merge_requests'
86 87 88
        get 'labels'
        get 'epics'
        get 'commands'
89
        get 'milestones'
90 91 92 93 94 95
      end
    end

    resources :billings, only: [:index]
    resources :epics, concerns: :awardable, constraints: { id: /\d+/ } do
      member do
96
        get '/descriptions/:version_id/diff', action: :description_diff, as: :description_diff
97
        delete '/descriptions/:version_id', action: :delete_description_version, as: :delete_description_version
98 99 100 101 102 103
        get :discussions, format: :json
        get :realtime_changes
        post :toggle_subscription
      end

      resources :epic_issues, only: [:index, :create, :destroy, :update], as: 'issues', path: 'issues'
Jarka Košanová's avatar
Jarka Košanová committed
104
      resources :epic_links, only: [:index, :create, :destroy, :update], as: 'links', path: 'links'
105 106 107 108

      scope module: :epics do
        resources :notes, only: [:index, :create, :destroy, :update], concerns: :awardable, constraints: { id: /\d+/ }
      end
109 110 111 112

      collection do
        post :bulk_update
      end
113 114
    end

115
    resources :iterations, only: [:index, :new, :edit, :show], constraints: { id: /\d+/ }
116

117
    resources :issues, only: [] do
Eugenia Grieff's avatar
Eugenia Grieff committed
118 119 120 121 122 123
      collection do
        post :bulk_update
      end
    end

    resources :merge_requests, only: [] do
124 125 126 127 128
      collection do
        post :bulk_update
      end
    end

129
    resources :todos, only: [:create]
130 131 132 133 134
    resources :boards, only: [:create, :update, :destroy] do
      collection do
        get :recent
      end
    end
135 136 137

    namespace :security do
      resource :dashboard, only: [:show], controller: :dashboard
Alexander Turinske's avatar
Alexander Turinske committed
138
      resources :vulnerabilities, only: [:index]
139
      resource :compliance_dashboard, only: [:show]
140
      resource :discover, only: [:show], controller: :discover
141
      resources :credentials, only: [:index]
142
      resources :merge_commit_reports, only: [:index], constraints: { format: :csv }
143 144
    end

145 146
    resource :push_rules, only: [:edit, :update]

147
    resource :saml_providers, path: 'saml', only: [:show, :create, :update] do
148 149
      callback_methods = Rails.env.test? ? [:get, :post] : [:post]
      match :callback, to: 'omniauth_callbacks#group_saml', via: callback_methods
150
      get :sso, to: 'sso#saml'
151
      delete :unlink, to: 'sso#unlink'
152 153
    end

James Lopez's avatar
James Lopez committed
154 155
    resource :scim_oauth, only: [:show, :create], controller: :scim_oauth

156 157
    get :sign_up, to: 'sso#sign_up_form'
    post :sign_up, to: 'sso#sign_up'
158
    post :authorize_managed_account, to: 'sso#authorize_managed_account'
159

160 161
    resource :roadmap, only: [:show], controller: 'roadmap'

162
    resource :dependency_proxy, only: [:show, :update]
163 164

    post '/restore' => '/groups#restore', as: :restore
165 166
  end
end
167 168 169

# Dependency proxy for containers
# Because docker adds v2 prefix to URI this need to be outside of usual group routes
170
scope format: false do
171
  get 'v2', to: proc { [200, {}, ['']] } # rubocop:disable Cop/PutGroupRoutesUnderScope
172

173
  constraints image: Gitlab::PathRegex.container_image_regex, sha: Gitlab::PathRegex.container_image_blob_sha_regex do
174 175
    get 'v2/*group_id/dependency_proxy/containers/*image/manifests/*tag' => 'groups/dependency_proxy_for_containers#manifest' # rubocop:todo Cop/PutGroupRoutesUnderScope
    get 'v2/*group_id/dependency_proxy/containers/*image/blobs/:sha' => 'groups/dependency_proxy_for_containers#blob' # rubocop:todo Cop/PutGroupRoutesUnderScope
176
  end
177
end