summaryrefslogtreecommitdiff
path: root/config/routes/import.rb
blob: 004839d22a7fd8bf64f292e0c3bb0d215afd0adc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# frozen_string_literal: true

# Alias import callbacks under the /users/auth endpoint so that
# the OAuth2 callback URL can be restricted under http://example.com/users/auth
# instead of http://example.com.
Devise.omniauth_providers.map(&:downcase).each do |provider|
  next if provider == 'ldapmain'

  get "/users/auth/-/import/#{provider}/callback", to: "import/#{provider}#callback", as: "users_import_#{provider}_callback"
end

namespace :import do
  resources :history, only: [:index], controller: :history

  resources :available_namespaces, only: [:index], controller: :available_namespaces

  namespace :url do
    post :validate
  end

  resource :github, only: [:create, :new], controller: :github do
    post :personal_access_token
    get :status
    get :callback
    get :realtime_changes
    post :cancel
  end

  resource :gitea, only: [:create, :new], controller: :gitea do
    post :personal_access_token
    get :status
    get :realtime_changes
  end

  resource :gitlab, only: [:create], controller: :gitlab do
    get :status
    get :callback
    get :realtime_changes
  end

  resource :bitbucket, only: [:create], controller: :bitbucket do
    get :status
    get :callback
    get :realtime_changes
  end

  resource :bitbucket_server, only: [:create, :new], controller: :bitbucket_server do
    post :configure
    get :status
    get :callback
    get :realtime_changes
  end

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

    get   :new_user_map,    path: :user_map
    post  :create_user_map, path: :user_map
  end

  resource :gitlab_project, only: [:create, :new] do
    post :create
    post :authorize
  end

  resource :gitlab_group, only: [:create] do
    post :authorize
  end

  resource :github_group, only: [] do
    get :status
  end

  resource :bulk_imports, only: [:create] do
    post :configure
    get :status
    get :realtime_changes
    get :history
  end

  resource :manifest, only: [:create, :new], controller: :manifest do
    get :status
    get :realtime_changes
    post :upload
  end

  resource :phabricator, only: [:create, :new], controller: :phabricator
end