routes.rb 19.0 KB
Newer Older
D
sidekiq  
Dmitriy Zaporozhets 已提交
1
require 'sidekiq/web'
2
require 'sidekiq/cron/web'
3
require 'api/api'
D
sidekiq  
Dmitriy Zaporozhets 已提交
4

V
Valery Sizov 已提交
5
Rails.application.routes.draw do
6 7 8 9 10 11 12 13 14 15 16 17 18
  if Gitlab::Sherlock.enabled?
    namespace :sherlock do
      resources :transactions, only: [:index, :show] do
        resources :queries, only: [:show]
        resources :file_samples, only: [:show]

        collection do
          delete :destroy_all
        end
      end
    end
  end

D
Douwe Maan 已提交
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
  namespace :ci do
    # CI API
    Ci::API::API.logger Rails.logger
    mount Ci::API::API => '/api'

    resource :lint, only: [:show, :create]

    resources :projects do
      member do
        get :status, to: 'projects#badge'
        get :integration
      end
    end

    root to: 'projects#index'
  end

V
Valery Sizov 已提交
36
  use_doorkeeper do
37 38 39
    controllers applications: 'oauth/applications',
                authorized_applications: 'oauth/authorized_applications',
                authorizations: 'oauth/authorizations'
V
Valery Sizov 已提交
40
  end
41

42 43 44 45 46
  # Autocomplete
  get '/autocomplete/users' => 'autocomplete#users'
  get '/autocomplete/users/:id' => 'autocomplete#user'


47
  # Search
48 49
  get 'search' => 'search#show'
  get 'search/autocomplete' => 'search#autocomplete', as: :search_autocomplete
V
Valery Sizov 已提交
50

51
  # API
52 53
  API::API.logger Rails.logger
  mount API::API => '/api'
54

55
  constraint = lambda { |request| request.env['warden'].authenticate? and request.env['warden'].user.admin? }
D
sidekiq  
Dmitriy Zaporozhets 已提交
56
  constraints constraint do
57
    mount Sidekiq::Web, at: '/admin/sidekiq', as: :sidekiq
D
sidekiq  
Dmitriy Zaporozhets 已提交
58
  end
A
Ariejan de Vroom 已提交
59

60
  # Enable Grack support
M
Marin Jankovski 已提交
61
  mount Grack::AuthSpawner, at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }, via: [:get, :post, :put]
62

63
  # Help
J
Job van der Voort 已提交
64
  get 'help'                  => 'help#index'
65
  get 'help/:category/:file'  => 'help#show', as: :help_page, constraints: { category: /.*/, file: /[^\/\.]+/ }
M
Marin Jankovski 已提交
66
  get 'help/shortcuts'
67
  get 'help/ui'               => 'help#ui'
68

A
Andrew8xx8 已提交
69 70 71 72 73
  #
  # Global snippets
  #
  resources :snippets do
    member do
74
      get 'raw'
A
Andrew8xx8 已提交
75 76
    end
  end
77 78

  get '/s/:username' => 'snippets#index', as: :user_snippets, constraints: { username: /.*/ }
A
Andrew8xx8 已提交
79

D
Douwe Maan 已提交
80 81 82 83 84 85 86
  #
  # Invites
  #

  resources :invites, only: [:show], constraints: { id: /[A-Za-z0-9_-]+/ } do
    member do
      post :accept
D
Douwe Maan 已提交
87
      match :decline, via: [:get, :post]
D
Douwe Maan 已提交
88 89
    end
  end
M
Marin Jankovski 已提交
90

91
  resources :sent_notifications, only: [], constraints: { id: /\h{32}/ } do
92 93 94 95 96
    member do
      get :unsubscribe
    end
  end

97 98 99
  # Spam reports
  resources :abuse_reports, only: [:new, :create]

V
Valery Sizov 已提交
100
  #
101
  # Import
V
Valery Sizov 已提交
102
  #
103 104
  namespace :import do
    resource :github, only: [:create, :new], controller: :github do
V
Valery Sizov 已提交
105 106 107 108 109
      get :status
      get :callback
      get :jobs
    end

110
    resource :gitlab, only: [:create, :new], controller: :gitlab do
V
Valery Sizov 已提交
111 112 113 114
      get :status
      get :callback
      get :jobs
    end
M
Marcin Kulik 已提交
115

D
Douwe Maan 已提交
116 117 118 119 120
    resource :bitbucket, only: [:create, :new], controller: :bitbucket do
      get :status
      get :callback
      get :jobs
    end
121

M
Marcin Kulik 已提交
122 123 124 125 126
    resource :gitorious, only: [:create, :new], controller: :gitorious do
      get :status
      get :callback
      get :jobs
    end
127 128 129 130 131

    resource :google_code, only: [:create, :new], controller: :google_code do
      get :status
      post :callback
      get :jobs
D
Douwe Maan 已提交
132 133 134

      get   :new_user_map,    path: :user_map
      post  :create_user_map, path: :user_map
135
    end
J
Jared Szechy 已提交
136 137 138 139 140 141 142 143 144

    resource :fogbugz, only: [:create, :new], controller: :fogbugz do
      get :status
      post :callback
      get :jobs

      get   :new_user_map,    path: :user_map
      post  :create_user_map, path: :user_map
    end
V
Valery Sizov 已提交
145
  end
M
Marin Jankovski 已提交
146

147 148 149
  #
  # Uploads
  #
M
Marin Jankovski 已提交
150

151 152
  scope path: :uploads do
    # Note attachments and User/Group/Project avatars
153 154
    get ":model/:mounted_as/:id/:filename",
        to:           "uploads#show",
155
        constraints:  { model: /note|user|group|project/, mounted_as: /avatar|attachment/, filename: /[^\/]+/ }
156 157

    # Project markdown uploads
158
    get ":namespace_id/:project_id/:secret/:filename",
159
      to:           "projects/uploads#show",
160
      constraints:  { namespace_id: /[a-zA-Z.0-9_\-]+/, project_id: /[a-zA-Z.0-9_\-]+/, filename: /[^\/]+/ }
161
  end
V
Valery Sizov 已提交
162

163
  # Redirect old note attachments path to new uploads path.
164 165
  get "files/note/:id/:filename",
    to:           redirect("uploads/note/attachment/%{id}/%{filename}"),
166
    constraints:  { filename: /[^\/]+/ }
167

168
  #
Y
Yatish Mehta 已提交
169
  # Explore area
170
  #
D
Dmitriy Zaporozhets 已提交
171 172 173 174
  namespace :explore do
    resources :projects, only: [:index] do
      collection do
        get :trending
175
        get :starred
D
Dmitriy Zaporozhets 已提交
176 177 178
      end
    end

179
    resources :groups, only: [:index]
180
    resources :snippets, only: [:index]
181
    root to: 'projects#trending'
182 183
  end

D
Dmitriy Zaporozhets 已提交
184
  # Compatibility with old routing
185 186
  get 'public' => 'explore/projects#index'
  get 'public/projects' => 'explore/projects#index'
D
Dmitriy Zaporozhets 已提交
187

188 189 190
  #
  # Admin Area
  #
N
Nihad Abbasov 已提交
191
  namespace :admin do
192
    resources :users, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do
193
      resources :keys, only: [:show, :destroy]
194
      resources :identities, except: [:show]
195

196
      delete 'stop_impersonation' => 'impersonation#destroy', on: :collection
197

198
      member do
D
Dmitriy Zaporozhets 已提交
199 200 201
        get :projects
        get :keys
        get :groups
D
Dmitriy Zaporozhets 已提交
202
        put :team_update
203 204
        put :block
        put :unblock
205
        put :unlock
206
        put :confirm
207
        post 'impersonate' => 'impersonation#create'
208
        patch :disable_two_factor
209
        delete 'remove/:email_id', action: 'remove_email', as: 'remove_email'
D
Dmitriy Zaporozhets 已提交
210 211
      end
    end
A
Andrey Kumanyaev 已提交
212

213
    resources :abuse_reports, only: [:index, :destroy]
214 215
    resources :spam_logs, only: [:index, :destroy]

V
Valery Sizov 已提交
216 217
    resources :applications

218 219
    resources :groups, constraints: { id: /[^\/]+/ } do
      member do
220
        put :members_update
221
      end
A
Andrey Kumanyaev 已提交
222
    end
A
Andrey Kumanyaev 已提交
223

224
    resources :deploy_keys, only: [:index, :new, :create, :destroy]
225

R
Robert Speicher 已提交
226
    resources :hooks, only: [:index, :create, :destroy] do
V
Valeriy Sizov 已提交
227 228
      get :test
    end
A
Andrey Kumanyaev 已提交
229

230 231 232 233
    resources :broadcast_messages, only: [:index, :edit, :create, :update, :destroy] do
      post :preview, on: :collection
    end

234
    resource :logs, only: [:show]
235
    resource :background_jobs, controller: 'background_jobs', only: [:show]
236

V
Vinnie Okada 已提交
237 238 239
    resources :namespaces, path: '/projects', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: [] do
      root to: 'projects#index', as: :projects

240 241
      resources(:projects,
                path: '/',
V
Vinnie Okada 已提交
242 243 244 245 246 247 248
                constraints: { id: /[a-zA-Z.0-9_\-]+/ },
                only: [:index, :show]) do
        root to: 'projects#show'

        member do
          put :transfer
        end
K
Kamil Trzcinski 已提交
249 250

        resources :runner_projects
251 252 253
      end
    end

M
Marin Jankovski 已提交
254 255
    resource :application_settings, only: [:show, :update] do
      resources :services
256
      put :reset_runners_token
M
Marin Jankovski 已提交
257
    end
258

V
Valery Sizov 已提交
259 260
    resources :labels

K
Kamil Trzcinski 已提交
261 262 263 264 265 266 267 268 269 270 271 272 273
    resources :runners, only: [:index, :show, :update, :destroy] do
      member do
        get :resume
        get :pause
      end
    end

    resources :builds, only: :index do
      collection do
        post :cancel_all
      end
    end

274
    root to: 'dashboard#index'
G
gitlabhq 已提交
275 276
  end

R
randx 已提交
277 278 279
  #
  # Profile Area
  #
280 281
  resource :profile, only: [:show, :update] do
    member do
V
Valery Sizov 已提交
282
      get :audit_log
D
Dmitriy Zaporozhets 已提交
283
      get :applications
284 285 286 287

      put :reset_private_token
      put :update_username
    end
D
Dmitriy Zaporozhets 已提交
288

289
    scope module: :profiles do
290 291 292 293 294
      resource :account, only: [:show, :update] do
        member do
          delete :unlink
        end
      end
295
      resource :notifications, only: [:show, :update]
296 297 298 299 300
      resource :password, only: [:new, :create, :edit, :update] do
        member do
          put :reset
        end
      end
301
      resource :preferences, only: [:show, :update]
302
      resources :keys
303
      resources :emails, only: [:index, :create, :destroy]
304
      resource :avatar, only: [:destroy]
305 306
      resource :two_factor_auth, only: [:new, :create, :destroy] do
        member do
307
          post :codes
G
Gabriel Mazetto 已提交
308
          patch :skip
309 310
        end
      end
311
    end
312
  end
R
Robert Speicher 已提交
313

314
  get 'u/:username/calendar' => 'users#calendar', as: :user_calendar,
315 316 317 318
      constraints: { username: /.*/ }

  get 'u/:username/calendar_activities' => 'users#calendar_activities', as: :user_calendar_activities,
      constraints: { username: /.*/ }
319

320
  get '/u/:username' => 'users#show', as: :user,
D
Douwe Maan 已提交
321
      constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }
D
Dmitriy Zaporozhets 已提交
322

R
randx 已提交
323 324 325
  #
  # Dashboard Area
  #
326 327 328 329
  resource :dashboard, controller: 'dashboard', only: [] do
    get :issues
    get :merge_requests
    get :activity
D
Douwe Maan 已提交
330 331 332

    scope module: :dashboard do
      resources :milestones, only: [:index, :show]
333

334
      resources :groups, only: [:index]
335
      resources :snippets, only: [:index]
336

337
      resources :projects, only: [:index] do
338 339 340 341
        collection do
          get :starred
        end
      end
D
Douwe Maan 已提交
342
    end
343 344

    root to: "dashboard/projects#index"
D
Dmitriy Zaporozhets 已提交
345
  end
G
gitlabhq 已提交
346

R
randx 已提交
347 348 349
  #
  # Groups Area
  #
D
Douwe Maan 已提交
350
  resources :groups, constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }  do
R
randx 已提交
351 352 353
    member do
      get :issues
      get :merge_requests
D
Dmitriy Zaporozhets 已提交
354
      get :projects
355
      get :events
R
randx 已提交
356
    end
357

S
Steven Thonus 已提交
358
    scope module: :groups do
359
      resources :group_members, only: [:index, :create, :update, :destroy] do
360
        post :resend_invite, on: :member
361
        delete :leave, on: :collection
362
      end
363

S
Steven Thonus 已提交
364
      resource :avatar, only: [:destroy]
365
      resources :milestones, constraints: { id: /[^\/]+/ }, only: [:index, :show, :update, :new, :create]
S
Steven Thonus 已提交
366
    end
R
randx 已提交
367 368
  end

369
  resources :projects, constraints: { id: /[^\/]+/ }, only: [:index, :new, :create]
370

371
  devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations , passwords: :passwords, sessions: :sessions, confirmations: :confirmations }
G
gitlabhq 已提交
372

373
  devise_scope :user do
374
    get '/users/auth/:provider/omniauth_error' => 'omniauth_callbacks#omniauth_error', as: :omniauth_error
375
  end
V
Vinnie Okada 已提交
376

377
  root to: "root#index"
V
Vinnie Okada 已提交
378

379 380 381
  #
  # Project Area
  #
V
Vinnie Okada 已提交
382
  resources :namespaces, path: '/', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: [] do
D
Douwe Maan 已提交
383
    resources(:projects, constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }, except:
V
Vinnie Okada 已提交
384 385 386
              [:new, :create, :index], path: "/") do
      member do
        put :transfer
387
        delete :remove_fork
V
Vinnie Okada 已提交
388 389
        post :archive
        post :unarchive
390
        post :housekeeping
V
Vinnie Okada 已提交
391 392 393
        post :toggle_star
        post :markdown_preview
        get :autocomplete_sources
394
        get :activity
S
skv 已提交
395
      end
396

V
Vinnie Okada 已提交
397 398 399 400 401 402 403 404 405
      scope module: :projects do
        # Blob routes:
        get '/new/*id', to: 'blob#new', constraints: { id: /.+/ }, as: 'new_blob'
        post '/create/*id', to: 'blob#create', constraints: { id: /.+/ }, as: 'create_blob'
        get '/edit/*id', to: 'blob#edit', constraints: { id: /.+/ }, as: 'edit_blob'
        put '/update/*id', to: 'blob#update', constraints: { id: /.+/ }, as: 'update_blob'
        post '/preview/*id', to: 'blob#preview', constraints: { id: /.+/ }, as: 'preview_blob'

        scope do
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422
          get(
            '/blob/*id/diff',
            to: 'blob#diff',
            constraints: { id: /.+/, format: false },
            as: :blob_diff
          )
          get(
            '/blob/*id',
            to: 'blob#show',
            constraints: { id: /.+/, format: false },
            as: :blob
          )
          delete(
            '/blob/*id',
            to: 'blob#destroy',
            constraints: { id: /.+/, format: false }
          )
L
liyakun 已提交
423 424 425 426 427 428 429 430 431 432
          put(
            '/blob/*id',
            to: 'blob#update',
            constraints: { id: /.+/, format: false }
          )
          post(
            '/blob/*id',
            to: 'blob#create',
            constraints: { id: /.+/, format: false }
          )
V
Vinnie Okada 已提交
433
        end
434

V
Vinnie Okada 已提交
435 436 437 438 439 440 441
        scope do
          get(
            '/raw/*id',
            to: 'raw#show',
            constraints: { id: /.+/, format: /(html|js)/ },
            as: :raw
          )
442
        end
443

V
Vinnie Okada 已提交
444 445 446 447 448 449 450 451 452
        scope do
          get(
            '/tree/*id',
            to: 'tree#show',
            constraints: { id: /.+/, format: /(html|js)/ },
            as: :tree
          )
        end

453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470
        scope do
          get(
            '/find_file/*id',
            to: 'find_file#show',
            constraints: { id: /.+/, format: /html/ },
            as: :find_file
          )
        end

        scope do
          get(
            '/files/*id',
            to: 'find_file#list',
            constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ },
            as: :files
          )
        end

S
Stan Hu 已提交
471 472
        scope do
          post(
G
Gabriel Mazetto 已提交
473
            '/create_dir/*id',
S
Stan Hu 已提交
474 475 476 477 478 479
              to: 'tree#create_dir',
              constraints: { id: /.+/ },
              as: 'create_dir'
          )
        end

V
Vinnie Okada 已提交
480 481 482 483 484 485 486
        scope do
          get(
            '/blame/*id',
            to: 'blame#show',
            constraints: { id: /.+/, format: /(html|js)/ },
            as: :blame
          )
487
        end
D
Dmitriy Zaporozhets 已提交
488

489 490 491 492
        scope do
          get(
            '/commits/*id',
            to: 'commits#show',
D
Dmitriy Zaporozhets 已提交
493
            constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ },
494 495 496 497 498
            as: :commits
          )
        end

        resource  :avatar, only: [:show, :destroy]
499
        resources :commit, only: [:show], constraints: { id: /\h{7,40}/ } do
500 501
          member do
            get :branches
K
Kamil Trzcinski 已提交
502 503 504
            get :builds
            post :cancel_builds
            post :retry_builds
505
          end
506 507 508 509 510 511
        end

        resources :compare, only: [:index, :create]
        resources :network, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ }

        resources :graphs, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ } do
V
Vinnie Okada 已提交
512 513
          member do
            get :commits
514
            get :ci
515
            get :languages
V
Vinnie Okada 已提交
516
          end
517
        end
V
Valery Sizov 已提交
518

V
Vinnie Okada 已提交
519 520
        get '/compare/:from...:to' => 'compare#show', :as => 'compare',
            :constraints => { from: /.+/, to: /.+/ }
521

V
Vinnie Okada 已提交
522 523 524 525
        resources :snippets, constraints: { id: /\d+/ } do
          member do
            get 'raw'
          end
526
        end
527

528
        WIKI_SLUG_ID = { id: /\S+/ } unless defined? WIKI_SLUG_ID
D
Dmitriy Zaporozhets 已提交
529

S
Stan Hu 已提交
530 531 532 533 534 535 536 537 538 539 540 541
        scope do
          # Order matters to give priority to these matches
          get '/wikis/git_access', to: 'wikis#git_access'
          get '/wikis/pages', to: 'wikis#pages', as: 'wiki_pages'
          post '/wikis', to: 'wikis#create'

          get '/wikis/*id/history', to: 'wikis#history', as: 'wiki_history', constraints: WIKI_SLUG_ID
          get '/wikis/*id/edit', to: 'wikis#edit', as: 'wiki_edit', constraints: WIKI_SLUG_ID

          get '/wikis/*id', to: 'wikis#show', as: 'wiki', constraints: WIKI_SLUG_ID
          delete '/wikis/*id', to: 'wikis#destroy', constraints: WIKI_SLUG_ID
          put '/wikis/*id', to: 'wikis#update', constraints: WIKI_SLUG_ID
542
        end
543

V
Vinnie Okada 已提交
544 545 546 547 548
        resource :repository, only: [:show, :create] do
          member do
            get 'archive', constraints: { format: Gitlab::Regex.archive_formats_regex }
          end
        end
M
miks 已提交
549

V
Vinnie Okada 已提交
550 551 552 553
        resources :services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do
          member do
            get :test
          end
554
        end
G
gitlabhq 已提交
555

556
        resources :deploy_keys, constraints: { id: /\d+/ }, only: [:index, :new, :create] do
V
Vinnie Okada 已提交
557 558 559 560
          member do
            put :enable
            put :disable
          end
561
        end
G
gitlabhq 已提交
562

563
        resources :forks, only: [:index, :new, :create]
V
Vinnie Okada 已提交
564 565 566 567 568 569 570 571 572 573
        resource :import, only: [:new, :create, :show]

        resources :refs, only: [] do
          collection do
            get 'switch'
          end

          member do
            # tree viewer logs
            get 'logs_tree', constraints: { id: Gitlab::Regex.git_reference_regex }
574 575
            # Directories with leading dots erroneously get rejected if git
            # ref regex used in constraints. Regex verification now done in controller.
576
            get 'logs_tree/*path' => 'refs#logs_tree', as: :logs_file, constraints: {
577
              id: /.*/,
V
Vinnie Okada 已提交
578 579 580
              path: /.*/
            }
          end
581
        end
582

V
Vinnie Okada 已提交
583 584
        resources :merge_requests, constraints: { id: /\d+/ }, except: [:destroy] do
          member do
585
            get :commits
V
Vinnie Okada 已提交
586
            get :diffs
D
Douwe Maan 已提交
587
            get :builds
588 589
            get :merge_check
            post :merge
590
            post :cancel_merge_when_build_succeeds
V
Vinnie Okada 已提交
591
            get :ci_status
V
tests  
Valery Sizov 已提交
592
            post :toggle_subscription
V
Vinnie Okada 已提交
593 594 595 596 597 598 599
          end

          collection do
            get :branch_from
            get :branch_to
            get :update_branches
          end
600
        end
601

V
Vinnie Okada 已提交
602
        resources :branches, only: [:index, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex }
603 604
        resources :tags, only: [:index, :show, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex } do
          resource :release, only: [:edit, :update]
605 606
        end

V
Vinnie Okada 已提交
607
        resources :protected_branches, only: [:index, :create, :update, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex }
608
        resource :variables, only: [:show, :update]
609
        resources :triggers, only: [:index, :create, :destroy]
610

611
        resources :builds, only: [:index, :show], constraints: { id: /\d+/ } do
K
Kamil Trzcinski 已提交
612
          collection do
K
Kamil Trzcinski 已提交
613
            post :cancel_all
614
            get :badge, path: 'status/*ref/badge',
615
                        constraints: { ref: Gitlab::Regex.git_reference_regex, format: /svg/ }
K
Kamil Trzcinski 已提交
616 617
          end

618 619
          member do
            get :status
620
            post :cancel
621 622
            post :retry
          end
623

624 625
          resource :artifacts, only: [] do
            get :download
626 627
            get :browse, path: 'browse(/*path)', format: false
            get :file, path: 'file/*path', format: false
628
          end
629
        end
630

V
Vinnie Okada 已提交
631 632 633 634
        resources :hooks, only: [:index, :create, :destroy], constraints: { id: /\d+/ } do
          member do
            get :test
          end
635
        end
636

637
        resources :milestones, constraints: { id: /\d+/ } do
V
Vinnie Okada 已提交
638 639 640 641
          member do
            put :sort_issues
            put :sort_merge_requests
          end
D
Dmitriy Zaporozhets 已提交
642
        end
643

V
Vinnie Okada 已提交
644 645 646 647
        resources :labels, constraints: { id: /\d+/ } do
          collection do
            post :generate
          end
648
        end
649

V
Vinnie Okada 已提交
650
        resources :issues, constraints: { id: /\d+/ }, except: [:destroy] do
V
Valery Sizov 已提交
651
          member do
V
tests  
Valery Sizov 已提交
652
            post :toggle_subscription
V
Valery Sizov 已提交
653
          end
V
Vinnie Okada 已提交
654 655 656
          collection do
            post  :bulk_update
          end
657
        end
R
Robert Speicher 已提交
658

659
        resources :project_members, except: [:new, :edit], constraints: { id: /[a-zA-Z.\/0-9_\-#%+]+/ } do
V
Vinnie Okada 已提交
660 661
          collection do
            delete :leave
D
Dmitriy Zaporozhets 已提交
662

V
Vinnie Okada 已提交
663 664 665 666 667
            # Used for import team
            # from another project
            get :import
            post :apply_import
          end
668 669 670 671

          member do
            post :resend_invite
          end
672
        end
D
Dmitriy Zaporozhets 已提交
673

V
Vinnie Okada 已提交
674 675 676 677
        resources :notes, only: [:index, :create, :destroy, :update], constraints: { id: /\d+/ } do
          member do
            delete :delete_attachment
          end
V
Valery Sizov 已提交
678 679 680 681

          collection do
            post :award_toggle
          end
682
        end
683 684 685

        resources :uploads, only: [:create] do
          collection do
686
            get ":secret/:filename", action: :show, as: :show, constraints: { filename: /[^\/]+/ }
687
          end
688
        end
689

690 691 692 693 694
        resources :runners, only: [:index, :edit, :update, :destroy, :show] do
          member do
            get :resume
            get :pause
          end
K
Kamil Trzcinski 已提交
695 696 697 698

          collection do
            post :toggle_shared_runners
          end
699
        end
K
Kamil Trzcinski 已提交
700 701

        resources :runner_projects, only: [:create, :destroy]
702
      end
703
    end
G
gitlabhq 已提交
704
  end
R
Robert Speicher 已提交
705

706 707 708
  # Get all keys of user
  get ':username.keys' => 'profiles/keys#get_keys' , constraints: { username: /.*/ }

709
  get ':id' => 'namespaces#show', constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ }
G
gitlabhq 已提交
710
end