-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathroutes.rb
More file actions
1230 lines (1038 loc) · 44.1 KB
/
Copy pathroutes.rb
File metadata and controls
1230 lines (1038 loc) · 44.1 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# frozen_string_literal: true
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++
Rails.application.routes.draw do
root to: "homescreen#index", as: "home"
rails_relative_url_root = OpenProject::Configuration["rails_relative_url_root"] || ""
# Route for error pages
get "/404", to: "errors#not_found"
get "/422", to: "errors#unacceptable"
get "/500", to: "errors#internal_error"
# Route for health_checks
get "/health_check" => "ok_computer/ok_computer#show", check: "web"
# Override the default `all` checks route to return the full check
get "/health_checks/all" => "ok_computer/ok_computer#show", check: "full"
mount OkComputer::Engine, at: "/health_checks"
get "/api/docs" => "api_docs#index"
mount API::Mcp => "/mcp"
# Redirect deprecated issue links to new work packages uris
get "/issues(/)" => redirect("#{rails_relative_url_root}/work_packages")
# The URI.escape doesn't escape / unless you ask it to.
# see https://github.com/rails/rails/issues/5688
get "/issues/*rest" => redirect { |params, _req|
"#{rails_relative_url_root}/work_packages/#{URI::RFC2396_Parser.new.escape(params[:rest])}"
}
# Respond with 410 gone for APIV2 calls
match "/api/v2(/*unmatched_route)", to: proc { [410, {}, [""]] }, via: :all
# Respond with 404 for source maps that are not found
# This prevents routing errors in test when developer mode is activated
match "/assets/compiler.js.map", to: proc { [404, {}, [""]] }, via: :all
match "*.css.map", to: proc { [404, {}, [""]] }, via: :all
# Redirect wp short url for work packages to full URL
get "/wp(/)" => redirect("#{rails_relative_url_root}/work_packages")
get "/wp/*rest" => redirect { |params, _req|
"#{rails_relative_url_root}/work_packages/#{URI::RFC2396_Parser.new.escape(params[:rest])}"
}
# Add catch method for Rack OmniAuth to allow route helpers
# Note: This renders a 404 in rails but is caught by omniauth in Rack before
get "/auth/failure", to: "omni_auth_login#failure", as: "omni_auth_failure"
get "/auth/:provider", to: proc { [404, {}, [""]] }, as: "omni_auth_start"
match "/auth/:provider/callback", to: "omni_auth_login#callback", as: "omni_auth_callback", via: %i[get post]
get "/.well-known/oauth-authorization-server", to: "oauth_metadata#authorization_server", as: :authorization_server_metadata
get "/.well-known/oauth-protected-resource", to: "oauth_metadata#protected_resource", as: :protected_resource_metadata
# In case assets are actually delivered by a node server (e.g. in test env)
# forward requests to the proxy
if FrontendAssetHelper.assets_proxied?
match "/assets/frontend/*appendix",
to: redirect("#{FrontendAssetHelper.cli_proxy}/assets/frontend/%{appendix}", status: 307),
format: false,
via: :all
end
# Shared route concerns
# TODO: Add description how to configure controller to support shares
concern :shareable do
resources :members, path: "shares", controller: "shares", only: %i[index create update destroy] do
member do
post "resend_invite" => "shares#resend_invite"
end
collection do
get :dialog, to: "shares#dialog"
patch :bulk, to: "shares#bulk_update"
put :bulk, to: "shares#bulk_update"
delete :bulk, to: "shares#bulk_destroy"
end
end
end
scope controller: "account" do
get "/account/force_password_change", action: "force_password_change"
post "/account/change_password", action: "change_password"
match "/account/lost_password", action: "lost_password", via: %i[get post]
match "/account/register", action: "register", via: %i[get post patch]
get "/account/activate", action: "activate"
match "/login", action: "login", as: "signin", via: %i[get post]
get "/login/internal", action: "internal_login", as: "internal_signin"
get "/logout", action: "logout", as: "signout"
get "/sso", action: "auth_source_sso_failed", as: "sso_failure"
get "/login/:stage/failure", action: "stage_failure", as: "stage_failure"
get "/login/:stage/:secret", action: "stage_success", as: "stage_success"
get "/account/consent", action: "consent", as: "account_consent"
get "/account/decline_consent", action: "decline_consent", as: "account_decline_consent"
post "/account/confirm_consent", action: "confirm_consent", as: "account_confirm_consent"
end
get "/external_redirect", to: "external_link_warning#show", as: "external_redirect"
resources :attribute_help_texts, only: [] do
member do
get :show_dialog
end
end
# Because of https://github.com/intridea/grape/pull/853/files this has to be
# placed behind handling the deprecated v1 because otherwise, a 405 is
# returned for all routes for which the v3 has also resources. Grape does
# remove the prefix (v3) before checking whether the method is supported. I
# don't understand why that should make sense.
mount API::Root => "/api"
# OAuth authorization routes
use_doorkeeper do
# Do not add global application controller
skip_controllers :applications, :authorized_applications
end
get "/roles/workflow/:id/:role_id/:type_id" => "roles#workflow"
resources :types, module: "work_package_types", except: [:update] do
resource :form_configuration, only: %i[edit update], controller: "form_configuration_tab" do
get :reset_dialog
resources :groups, only: %i[create edit update destroy], controller: "form_configuration_groups_tab", param: :key do
collection do
post :add_group
end
member do
post :cancel_edit
put :drop
put :move
patch :update_query
end
end
resources :rows, only: %i[destroy], controller: "form_configuration_tab", param: :row_key do
member do
put :drop
put :move
end
end
end
resource :projects, controller: "projects_tab", only: %i[update edit] do
collection do
post :enable_all, to: "projects_tab#enable_all_projects"
end
end
resource :settings, controller: "settings_tab", only: %i[update edit]
resource :subject_configuration, controller: "subject_configuration_tab", only: %i[update edit]
resources :pdf_export_template, only: %i[],
controller: "pdf_export_template",
path: "pdf_export_template" do
member do
post :toggle
put :drop
end
collection do
get :edit
put :enable_all
put :disable_all
end
end
collection do
post "move/:id", action: "move"
end
end
resources :statuses, except: :show
get "custom_style/:digest/logo/:filename" => "custom_styles#logo_download",
as: "custom_style_logo",
constraints: { filename: /[^\/]*/ }
get "custom_style/:digest/logo_mobile/:filename" => "custom_styles#logo_mobile_download",
as: "custom_style_logo_mobile",
constraints: { filename: /[^\/]*/ }
get "custom_style/:digest/export_logo/:filename" => "custom_styles#export_logo_download",
as: "custom_style_export_logo",
constraints: { filename: /[^\/]*/ }
get "custom_style/:digest/export_cover/:filename" => "custom_styles#export_cover_download",
as: "custom_style_export_cover",
constraints: { filename: /[^\/]*/ }
get "custom_style/:digest/export_footer/:filename" => "custom_styles#export_footer_download",
as: "custom_style_export_footer",
constraints: { filename: /[^\/]*/ }
get "custom_style/:digest/favicon/:filename" => "custom_styles#favicon_download",
as: "custom_style_favicon",
constraints: { filename: /[^\/]*/ }
get "custom_style/:digest/touch-icon/:filename" => "custom_styles#touch_icon_download",
as: "custom_style_touch_icon",
constraints: { filename: /[^\/]*/ }
get "highlighting/styles(/:version_tag)" => "highlighting#styles",
as: "highlighting_css_styles"
resources :custom_fields, except: :show do
member do
delete "options/:option_id", to: "custom_fields#delete_option", as: :delete_option_of
post :reorder_alphabetical
get :attribute_help_text
put :update_attribute_help_text
get :list_items
end
scope module: :admin do
scope module: :custom_fields do
resources :projects, controller: "/admin/custom_fields/custom_field_projects", only: %i[index new create]
resource :project, controller: "/admin/custom_fields/custom_field_projects", only: :destroy
resources :items, controller: "/admin/custom_fields/hierarchy/items" do
member do
get :change_parent, action: :change_parent_dialog
post :change_parent, action: :change_parent
get :delete, action: :deletion_dialog
get :item_actions
post :move
get :new_child, action: :new
post :new_child, action: :create
end
end
end
end
end
get "(projects/:project_id)/search" => "search#index", as: "search"
# only providing routes for journals when there are multiple subclasses of journals
# all subclasses will look for the journals routes
resources :journals, only: :index do
get "diff/:field", action: :diff, on: :member, as: "diff"
end
# REVIEW: review those wiki routes
scope "projects/:project_id/wiki/:id" do
resource :wiki_menu_item, only: %i[edit update]
end
# generic route for adding/removing watchers
scope ":object_type/:object_id", constraints: OpenProject::Acts::Watchable::RouteConstraint do
post "/watch" => "watchers#watch"
delete "/unwatch" => "watchers#unwatch"
end
# generic route for adding/removing favorites
scope ":object_type/:object_id", constraints: OpenProject::Acts::Favoritable::RouteConstraint do
post "/favorite" => "favorites#favorite"
delete "/favorite" => "favorites#unfavorite"
end
resources :project_queries, only: %i[show new create update destroy], controller: "projects/queries" do
concerns :shareable
member do
get :rename
post :toggle_public
get :destroy_confirmation_modal
end
collection do
get :configure_view_modal
end
end
namespace :projects do
resource :menu, only: %i[show]
resource :filters, only: %i[show]
resource :identifier_suggestion, only: %i[show], controller: "identifier_suggestion"
end
%w[portfolio project program].each do |workspace_type|
resources workspace_type.pluralize,
only: %i[new create],
defaults: { workspace_type: },
controller: workspace_type.pluralize
end
resources :projects, except: %i[new create show edit update] do
scope module: "projects" do
namespace "settings" do
resource :general, only: %i[show update], controller: "general" do
get :toggle_public_dialog
post :toggle_public
end
resource :modules, only: %i[show update]
resource :subitems, only: %i[show update]
resource :template, only: %i[show update], controller: "template" do
post :toggle_template, on: :member
end
resource :creation_wizard, controller: "creation_wizard", only: %i[show] do
get :disable_dialog
post :toggle
post :update_name_settings
post :update_submission_settings
post :update_artifact_export_settings
get :refresh_submission_form
post :toggle_project_custom_field
put :enable_all_of_section
put :disable_all_of_section
end
resource :project_custom_fields, only: %i[show] do
member do
post :toggle
end
collection do
put :enable_all_of_section
put :disable_all_of_section
end
end
resources :life_cycle_steps, only: %i[index], path: "life_cycle" do
member do
post :toggle
end
collection do
post :enable_all
post :disable_all
end
end
resource :repository, only: %i[show], controller: "repository"
resource :versions, only: %i[show]
resource :storage, only: %i[show], controller: "storage"
get :types, to: redirect("projects/%{project_id}/settings/work_packages/types")
get :custom_fields, to: redirect("projects/%{project_id}/settings/work_packages/custom_fields")
get :categories, to: redirect("projects/%{project_id}/settings/work_packages/categories")
resource :work_packages, only: %i[show]
namespace :work_packages do
resource :internal_comments, only: %i[show update]
resource :types, only: %i[show update]
resource :custom_fields, only: %i[show update]
resource :categories, only: %i[show update]
end
end
resource :templated, only: %i[create destroy], controller: "templated"
resource :archive, only: %i[create destroy], controller: "archive" do
collection do
get :dialog
end
end
resource :identifier, only: %i[show update], controller: "identifier" do
get :identifier_update_dialog, on: :member, defaults: { format: :turbo_stream }
end
resource :status, only: %i[update destroy], controller: "status"
resource :creation_wizard, only: %i[show update], controller: "creation_wizard" do
get :help_text, on: :member
end
end
member do
get "settings", to: redirect("projects/%{id}/settings/general/")
get "export_project_initiation", to: "projects#export_project_initiation_pdf"
get :copy, to: "projects#copy_form"
post :copy
patch :types
# Destroy uses a get request to prompt the user before the actual DELETE request
get :destroy_info, as: "confirm_destroy"
post :deactivate_work_package_attachments
end
resources :versions, only: %i[new create] do
collection do
put :close_completed
end
end
# this is only another name for versions#index
# For nice "road in the url for the index action
# this could probably be rewritten with a resource as: 'roadmap'
get "/roadmap" => "versions#index"
resources :news do
resources :comments, controller: "news/comments", only: %i[create destroy]
end
# Match everything to be the ID of the wiki page except the part that
# is reserved for the format. This assumes that we have only two formats:
# .txt and .html
resources :wiki,
constraints: { id: /([^\/]+(?=\.markdown)|[^\/]+)/ },
except: %i[index create] do
collection do
post "/new" => "wiki#create", as: "create"
get :export
get "/index" => "wiki#index"
get :menu
end
member do
get "/new" => "wiki#new_child", as: "new_child"
get "/diff/:version/vs/:version_from" => "wiki#diff", as: "wiki_diff_compare"
get "/diff(/:version)" => "wiki#diff", as: "wiki_diff"
get "/annotate/:version" => "wiki#annotate", as: "wiki_annotate"
get "/toc" => "wiki#index"
match :rename, via: %i[get patch]
get :parent_page, action: "edit_parent_page"
patch :parent_page, action: "update_parent_page"
get :history
post :protect
get :select_main_menu_item, to: "wiki_menu_items#select_main_menu_item"
post :replace_main_menu_item, to: "wiki_menu_items#replace_main_menu_item"
get :menu
end
end
# as routes for index and show are swapped
# it is necessary to define the show action later
# than any other route as it otherwise would
# work as a catchall for everything under /wiki
get "wiki" => "wiki#show"
resources :work_packages, only: %i[index show] do
collection do
get "/report/:detail" => "work_packages/reports#report_details"
get "/report" => "work_packages/reports#report"
get "menu" => "work_packages/menus#show"
get "/export_dialog" => "work_packages#export_dialog"
end
get "/copy" => "work_packages#copy", on: :member, as: "copy"
get "/new" => "work_packages#new", on: :collection, as: "new"
get "(/:tab)" => "work_packages#show", on: :member, as: "",
constraints: { id: WorkPackage::SemanticIdentifier::ID_ROUTE_CONSTRAINT, state: /(?!(shares|copy|dialog)).+/ }
# states managed by client-side routing on work_package#index
get "(/*state)" => "work_packages#index", on: :collection, as: "", constraints: { state: /(?!(dialog|new)).+/ }
get "/create_new" => "work_packages#index", on: :collection, as: "new_split"
end
namespace :work_packages do
resource :dialog, only: %i[new create] do
post :refresh_form
end
end
resources :activity, :activities, only: :index, controller: "activities" do
collection do
get :menu
end
end
resources :forums do
resources :topics, controller: "messages", except: [:index] do
member do
get :quote
post :reply, as: "reply_to"
end
end
member do
get :confirm_destroy
get :move
post :move
end
end
resources :categories, except: %i[index show], shallow: true
resources :members, only: %i[index create update] do
collection do
delete "by_principal/:principal_id", action: :destroy_by_principal
get :autocomplete_for_member
get :menu, to: "members/menus#show"
end
end
resource :repository, controller: "repositories", except: [:new] do
# Destroy uses a get request to prompt the user before the actual DELETE request
get :destroy_info
get :committers
post :committers
get :graph
get :revisions
get "/statistics", action: :stats, as: "stats"
get "(/revisions/:rev)/diff.:format", action: :diff
get "(/revisions/:rev)/diff(/*repo_path)",
action: :diff,
format: "html",
constraints: { rev: /[\w.-]+/, repo_path: /.*/ }
get "(/revisions/:rev)/:format/*repo_path",
action: :entry,
format: /raw/,
rev: /[\w.-]+/
%w{diff annotate changes entry browse}.each do |action|
get "(/revisions/:rev)/#{action}(/*repo_path)",
format: "html",
action:,
constraints: { rev: /[\w.-]+/, repo_path: /.*/ },
as: "#{action}_revision"
end
get "/revision(/:rev)", rev: /[\w.-]+/,
action: :revision,
as: "show_revision"
get "(/revisions/:rev)(/*repo_path)",
action: :show,
format: "html",
constraints: { rev: /[\w.-]+/, repo_path: /.*/ },
as: "show_revisions_path"
end
end
resources :portfolios,
only: %i[index]
namespace :portfolios do
resource :menu, only: %i[show]
end
resources :project_phases, only: [] do
member do
get "/hover_card" => "project_phases/hover_card#show", as: "hover_card"
end
end
resources :admin, controller: :admin, only: :index do
collection do
get :plugins
get :info
post :test_email
end
end
scope "admin" do
resource :announcements, only: %i[edit update]
get "/enterprise", to: redirect("#{rails_relative_url_root}/admin/enterprise_tokens")
constraints(Constraints::Enterprise) do
resources :enterprise_tokens, only: %i[index new create destroy] do
member do
get :destroy_dialog
end
collection do
post :save_trial_key
delete :delete_trial_key
end
end
resource :enterprise_trial, only: %i[show create destroy] do
get :trial_dialog
post :request_resend, on: :collection
end
end
delete "design/logo" => "custom_styles#logo_delete", as: "custom_style_logo_delete"
delete "design/logo_mobile" => "custom_styles#logo_mobile_delete", as: "custom_style_logo_mobile_delete"
delete "design/export_logo" => "custom_styles#export_logo_delete", as: "custom_style_export_logo_delete"
delete "design/export_cover" => "custom_styles#export_cover_delete", as: "custom_style_export_cover_delete"
delete "design/export_footer" => "custom_styles#export_footer_delete", as: "custom_style_export_footer_delete"
delete "design/export_font_regular" => "custom_styles#export_font_regular_delete",
as: "custom_style_export_font_regular_delete"
delete "design/export_font_bold" => "custom_styles#export_font_bold_delete", as: "custom_style_export_font_bold_delete"
delete "design/export_font_italic" => "custom_styles#export_font_italic_delete", as: "custom_style_export_font_italic_delete"
delete "design/export_font_bold_italic" => "custom_styles#export_font_bold_italic_delete",
as: "custom_style_export_font_bold_italic_delete"
delete "design/favicon" => "custom_styles#favicon_delete", as: "custom_style_favicon_delete"
delete "design/touch_icon" => "custom_styles#touch_icon_delete", as: "custom_style_touch_icon_delete"
post "design/colors" => "custom_styles#update_colors", as: "update_design_colors"
post "design/themes" => "custom_styles#update_themes", as: "update_design_themes"
post "design/export_cover_text_color" => "custom_styles#update_export_cover_text_color",
as: "update_custom_style_export_cover_text_color"
resource :custom_style, only: %i[update show create], path: "design" do
get :export_demo_pdf_download
end
resources :attribute_help_texts, only: %i(index new create edit update destroy)
resources :groups, except: %i[show] do
member do
# this should be put into its own resource
post "/members" => "groups#add_users", as: "members_of"
delete "/members/:user_id" => "groups#remove_user", as: "member_of"
# this should be put into its own resource
patch "/memberships/:membership_id" => "groups#edit_membership", as: "membership_of"
put "/memberships/:membership_id" => "groups#edit_membership"
delete "/memberships/:membership_id" => "groups#destroy_membership"
post "/memberships" => "groups#create_memberships", as: "memberships_of"
end
end
resources :roles, except: %i[show] do
collection do
put "/" => "roles#bulk_update"
get :report
end
end
resources :ldap_auth_sources do
member do
get :test_connection
end
end
resources :mcp_configurations, only: %i[index update], controller: "admin/mcp_configurations" do
collection do
post :multi_update
end
end
resources :custom_actions, except: :show
namespace :oauth do
resources :applications do
member do
post :toggle
end
end
end
end
namespace :admin do
namespace :settings do
resource :general, controller: "/admin/settings/general_settings", only: %i[show update]
resource :languages, controller: "/admin/settings/languages_settings", only: %i[show update]
resource :external_links, controller: "/admin/settings/external_links_settings", only: %i[show update]
resource :repositories, controller: "/admin/settings/repositories_settings", only: %i[show update]
resource :experimental, controller: "/admin/settings/experimental_settings", only: %i[show update]
resource :authentication, controller: "/admin/settings/authentication_settings", only: %i[show update]
resource :attachments, controller: "/admin/settings/attachments_settings", only: %i[show update]
resource :virus_scanning, controller: "/admin/settings/virus_scanning_settings", only: %i[show update] do
collection do
get :av_form
end
end
resource :incoming_mails, controller: "/admin/settings/incoming_mails_settings", only: %i[show update]
resource :aggregation, controller: "/admin/settings/aggregation_settings", only: %i[show update]
resource :mail_notifications, controller: "/admin/settings/mail_notifications_settings", only: %i[show update]
resource :api, controller: "/admin/settings/api_settings", only: %i[show update]
# It is important to have this named something else than "work_packages".
# Otherwise the angular ui-router will also recognize that as a WorkPackage page and apply according classes.
resource :work_packages_general, controller: "/admin/settings/work_packages_general", only: %i[show update]
resource :work_packages_identifier, controller: "/admin/settings/work_packages_identifier", only: %i[show update] do
get :status, on: :member
get :confirm_dialog, on: :member, defaults: { format: :turbo_stream }
end
resources :work_package_priorities, except: [:show] do
member do
put :move
get :reassign
end
end
resource :progress_tracking, controller: "/admin/settings/progress_tracking", only: %i[show update]
resource :projects, controller: "/admin/settings/projects_settings", only: %i[show update]
resource :new_project, controller: "/admin/settings/new_project_settings", only: %i[show update]
resources :project_phase_definitions,
controller: "/admin/settings/project_phase_definitions",
except: :show do
member do
patch :move
put :drop # should be patch, but requires passing method to generic-drag-and-drop controller
end
end
resources :project_custom_fields, controller: "/admin/settings/project_custom_fields" do
member do
delete "options/:option_id", action: "delete_option", as: :delete_option_of
post :reorder_alphabetical
put :move
put :drop
get :project_mappings
get :new_link
post :link
delete :unlink
get :role_assignment
post :update_role_assignment
get :role_assignment_preview_dialog
get :attribute_help_text
put :update_attribute_help_text
get :list_items
end
resources :items, controller: "/admin/settings/project_custom_fields/hierarchy/items" do
member do
get :change_parent, action: :change_parent_dialog
post :change_parent, action: :change_parent
get :delete, action: :deletion_dialog
get :item_actions
post :move
get :new_child, action: :new
post :new_child, action: :create
end
end
end
resources :project_custom_field_sections, controller: "/admin/settings/project_custom_field_sections",
only: %i[create update destroy] do
member do
put :move
put :drop
end
collection do
get :new_link
end
end
resource :working_days_and_hours, controller: "/admin/settings/working_days_and_hours_settings", only: %i[show update]
post "working_days_and_hours/confirm_changes",
to: "/admin/settings/working_days_and_hours_settings#confirm_changes",
as: :confirm_changes_admin_settings_working_days_and_hours
resource :users, controller: "/admin/settings/users_settings", only: %i[show update]
resource :date_format, controller: "/admin/settings/date_format_settings", only: %i[show update]
resource :icalendar, controller: "/admin/settings/icalendar_settings", only: %i[show update]
# Redirect /settings to general settings
get "/", to: redirect("/admin/settings/general")
# Plugin settings
get "plugin/:id", action: :show_plugin, as: :show_plugin
post "plugin/:id", action: :update_plugin
end
namespace :import do
get "/", to: redirect("/admin/import/jira")
resources :jira, controller: "/admin/import/jira/instances" do
collection do
post :test
end
member do
delete :delete_token
end
resources :run, controller: "/admin/import/jira/import_runs", module: :jiras do
member do
get :continue
post :continue
delete :remove
get :import_modal
get :revert_modal
get :finalize_modal
get :history
end
resource :select_projects,
controller: "/admin/import/jira/import_runs/select_projects",
only: %i[show update] do
post :filter
get :switch_page
get :check_all
get :uncheck_all
get :toggle
end
end
end
end
resources :quarantined_attachments,
controller: "/admin/attachments/quarantined_attachments",
only: %i[index destroy]
resources :scim_clients, only: %i[index edit new create update destroy] do
member do
get :deletion_dialog
end
resources :static_tokens, only: %i[create destroy], controller: "/admin/scim_client_static_tokens" do
member do
get :deletion_dialog
end
end
end
resource :backups, controller: "/admin/backups", only: %i[show] do
collection do
get :reset_token
post :reset_token, action: :perform_token_reset
post :delete_token
end
end
resources :departments,
only: %i[index show edit update destroy],
constraints: lambda { |_request| OpenProject::FeatureDecisions.departments_active? } do
member do
get :new_user
post :add_user
delete "remove_user/:user_id" => "departments#remove_user", as: :remove_user
get :change_parent, action: :change_parent_dialog
post :change_parent
# old routes for old group style management, might remove when new interface
patch "/memberships:membership_id" => "departments#edit_membership", as: "membership_of"
put "/memberships:membership_id" => "departments#edit_membership"
delete "/memberships:membership_id" => "departments#destroy_membership"
post "/memberships" => "departments#create_memberships", as: "memberships_of"
end
collection do
get :new_department
post :add_department
get :edit_organization_name
patch :cancel_edit_organization_name
patch :update_organization_name
end
end
end
resources :workflows, only: %i[index edit], param: :type_id do
scope module: :workflows do
resources :tabs, only: %i[edit update], param: :tab do # params[:tab] used in TabsHelper
member do
get :status_dialog
post :confirm_statuses
end
end
resource :copy, only: %i[new] do
scope module: :copies do
resource :from_type, only: %i[create]
resource :from_role, only: %i[create]
end
end
end
end
namespace :workflows do
resource :summary, only: %i[show]
end
namespace :work_packages do
get "menu" => "menus#show"
match "auto_complete" => "auto_completes#index", via: %i[get post]
resource :bulk, controller: "bulk", only: %i[edit update destroy] do
collection do
match :reassign, via: %i[get delete]
get :delete_dialog
end
end
end
resources :work_packages, only: %i[index show new] do
concerns :shareable
get "hover_card" => "work_packages/hover_card#show", on: :member
get "generate_pdf_dialog" => "work_packages#generate_pdf_dialog", on: :member
post "generate_pdf" => "work_packages#generate_pdf", on: :member
# move bulk of wps
get "move/new" => "work_packages/moves#new", on: :collection, as: "new_move"
post "move" => "work_packages/moves#create", on: :collection, as: "move"
# move individual wp
resource :move, controller: "work_packages/moves", only: %i[new create]
# states managed by client-side routing on work_package#index
get "details/*state" => "work_packages#index", on: :collection, as: :details
resources :activities, controller: "work_packages/activities_tab", only: %i[index create edit update] do
member do
get :cancel_edit
get :emoji_actions
get :item_actions
put :toggle_reaction
end
collection do
get :page_streams
get :update_streams
get :update_filter # filter not persisted
put :update_sorting # sorting is persisted
post :sanitize_internal_mentions
end
end
resources :hierarchy_relations, only: %i[new create destroy], controller: "work_package_hierarchy_relations"
resource :progress, only: %i[edit update], controller: "work_packages/progress" do
get :preview, on: :member
end
collection do
resource :progress,
only: %i[create new],
controller: "work_packages/progress",
as: :work_package_progress do
get :preview, on: :collection
end
end
resource :date_picker,
only: %i[show edit update],
controller: "work_packages/date_picker",
as: "date_picker" do
get :preview, on: :member
end
collection do
resource :date_picker,
only: %i[create new],
controller: "work_packages/date_picker",
as: "date_picker" do
get :preview, on: :collection
end
end
resources :relations_tab, only: %i[index], controller: "work_package_relations_tab"
resources :relations, only: %i[new create edit update destroy], controller: "work_package_relations"
resources :reminders,
controller: "work_packages/reminders",
only: %i[create update destroy] do
get :modal_body, on: :collection
end
get "/export_dialog" => "work_packages#export_dialog", on: :collection, as: "export_dialog"
get :show_conflict_flash_message, on: :collection # we don't need a specific work package for this
get "/split_view/update_counter" => "work_packages/split_view#update_counter",
on: :member
get "/split_view/get_relations_counter" => "work_packages/split_view#get_relations_counter",
on: :member
get "/copy" => "work_packages#copy", on: :member, as: "copy"
get "(/:tab)" => "work_packages#show", on: :member, as: "",
constraints: { id: WorkPackage::SemanticIdentifier::ID_ROUTE_CONSTRAINT, state: /(?!(shares|new|copy)).+/ }
# states managed by client-side (angular) routing on work_package#show
get "/" => "work_packages#index", on: :collection, as: "index"
get "/create_new" => "work_packages#index", on: :collection, as: "new_split"
get "/share_upsell" => "work_packages#share_upsell", on: :collection, as: "share_upsell"
get "/edit" => "work_packages#show", on: :member, as: "edit"
end
resources :versions, only: %i[show edit update destroy] do
member do
get :status_by
end
end
resources :activity, :activities, only: :index, controller: "activities" do
collection do
get :menu
end
end
resources :users, constraints: { id: /(\d+|me)/ }, except: :edit do
collection do
get :configure_view_modal
end
resources :memberships, controller: "users/memberships", only: %i[update create destroy]
resources :working_hours, controller: "users/working_hours", except: [:index]
resources :non_working_times, controller: "users/non_working_times", except: [:index] do
collection do