Add 'apps/arv-web/' from commit 'f9732ad8460d013c2f28363655d0d1b91894dca5'
[arvados.git] / services / api / config / routes.rb
1 Server::Application.routes.draw do
2   themes_for_rails
3
4   # See http://guides.rubyonrails.org/routing.html
5
6   # OPTIONS requests are not allowed at routes that use cookies.
7   ['/auth/*a', '/login', '/logout'].each do |nono|
8     match nono, :to => 'user_sessions#cross_origin_forbidden', :via => 'OPTIONS'
9   end
10   # OPTIONS at discovery and API paths get an empty response with CORS headers.
11   match '/discovery/v1/*a', :to => 'static#empty', :via => 'OPTIONS'
12   match '/arvados/v1/*a', :to => 'static#empty', :via => 'OPTIONS'
13
14   namespace :arvados do
15     namespace :v1 do
16       resources :api_client_authorizations do
17         post 'create_system_auth', on: :collection
18       end
19       resources :api_clients
20       resources :authorized_keys
21       resources :collections do
22         get 'provenance', on: :member
23         get 'used_by', on: :member
24       end
25       resources :groups do
26         get 'contents', on: :collection
27         get 'contents', on: :member
28       end
29       resources :humans
30       resources :job_tasks
31       resources :jobs do
32         get 'queue', on: :collection
33         get 'queue_size', on: :collection
34         post 'cancel', on: :member
35         post 'lock', on: :member
36       end
37       resources :keep_disks do
38         post 'ping', on: :collection
39       end
40       resources :keep_services do
41         get 'accessible', on: :collection
42       end
43       resources :links
44       resources :logs
45       resources :nodes do
46         post 'ping', on: :member
47       end
48       resources :pipeline_instances
49       resources :pipeline_templates
50       resources :repositories do
51         get 'get_all_permissions', on: :collection
52       end
53       resources :specimens
54       resources :traits
55       resources :user_agreements do
56         get 'signatures', on: :collection
57         post 'sign', on: :collection
58       end
59       resources :users do
60         get 'current', on: :collection
61         get 'system', on: :collection
62         post 'activate', on: :member
63         post 'setup', on: :collection
64         post 'unsetup', on: :member
65       end
66       resources :virtual_machines do
67         get 'logins', on: :member
68         get 'get_all_logins', on: :collection
69       end
70       get '/permissions/:uuid', :to => 'links#get_permissions'
71     end
72   end
73
74   if Rails.env == 'test'
75     post '/database/reset', to: 'database#reset'
76   end
77
78   # omniauth
79   match '/auth/:provider/callback', :to => 'user_sessions#create'
80   match '/auth/failure', :to => 'user_sessions#failure'
81   # not handled by omniauth provider -> 403 with no CORS headers.
82   get '/auth/*a', :to => 'user_sessions#cross_origin_forbidden'
83
84   # Custom logout
85   match '/login', :to => 'user_sessions#login'
86   match '/logout', :to => 'user_sessions#logout'
87
88   match '/discovery/v1/apis/arvados/v1/rest', :to => 'arvados/v1/schema#index'
89
90   match '/static/login_failure', :to => 'static#login_failure', :as => :login_failure
91
92   # Send unroutable requests to an arbitrary controller
93   # (ends up at ApplicationController#render_not_found)
94   match '*a', :to => 'static#render_not_found'
95
96   root :to => 'static#home'
97 end