18676: remove script/get_anonymous_user_token.rb and update
[arvados.git] / services / api / lib / enable_jobs_api.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 Disable_update_jobs_api_method_list = ConfigLoader.to_OrderedOptions({
6                                         "jobs.create"=>{},
7                                         "pipeline_instances.create"=>{},
8                                         "pipeline_templates.create"=>{},
9                                         "jobs.update"=>{},
10                                         "pipeline_instances.update"=>{},
11                                         "pipeline_templates.update"=>{},
12                                         "job_tasks.create"=>{},
13                                         "job_tasks.update"=>{}
14                                       })
15
16 Disable_jobs_api_method_list = ConfigLoader.to_OrderedOptions({
17                                 "jobs.create"=>{},
18                                 "pipeline_instances.create"=>{},
19                                 "pipeline_templates.create"=>{},
20                                 "jobs.get"=>{},
21                                 "pipeline_instances.get"=>{},
22                                 "pipeline_templates.get"=>{},
23                                 "jobs.list"=>{},
24                                 "pipeline_instances.list"=>{},
25                                 "pipeline_templates.list"=>{},
26                                 "jobs.index"=>{},
27                                 "pipeline_instances.index"=>{},
28                                 "pipeline_templates.index"=>{},
29                                 "jobs.update"=>{},
30                                 "pipeline_instances.update"=>{},
31                                 "pipeline_templates.update"=>{},
32                                 "jobs.queue"=>{},
33                                 "jobs.queue_size"=>{},
34                                 "job_tasks.create"=>{},
35                                 "job_tasks.get"=>{},
36                                 "job_tasks.list"=>{},
37                                 "job_tasks.index"=>{},
38                                 "job_tasks.update"=>{},
39                                 "jobs.show"=>{},
40                                 "pipeline_instances.show"=>{},
41                                 "pipeline_templates.show"=>{},
42                                 "job_tasks.show"=>{}})
43
44 def check_enable_legacy_jobs_api
45   # Create/update is permanently disabled (legacy functionality has been removed)
46   Rails.configuration.API.DisabledAPIs.merge! Disable_update_jobs_api_method_list
47
48   if Rails.configuration.Containers.JobsAPI.Enable == "false" ||
49      (Rails.configuration.Containers.JobsAPI.Enable == "auto" &&
50       Job.count == 0)
51     Rails.configuration.API.DisabledAPIs.merge! Disable_jobs_api_method_list
52   end
53 end