##// END OF EJS Templates
fix: fix ajax request route to update client whitelist config
andverb -
r5534:80a291fb default
parent child Browse files
Show More
@@ -1,1124 +1,1124 b''
1 1 # Copyright (C) 2016-2023 RhodeCode GmbH
2 2 #
3 3 # This program is free software: you can redistribute it and/or modify
4 4 # it under the terms of the GNU Affero General Public License, version 3
5 5 # (only), as published by the Free Software Foundation.
6 6 #
7 7 # This program is distributed in the hope that it will be useful,
8 8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 10 # GNU General Public License for more details.
11 11 #
12 12 # You should have received a copy of the GNU Affero General Public License
13 13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 14 #
15 15 # This program is dual-licensed. If you wish to learn more about the
16 16 # RhodeCode Enterprise Edition, including its added features, Support services,
17 17 # and proprietary license terms, please see https://rhodecode.com/licenses/
18 18
19 19
20 20 from rhodecode.apps._base import ADMIN_PREFIX
21 21 from rhodecode.apps._base.navigation import includeme as nav_includeme
22 22 from rhodecode.apps.admin.views.main_views import AdminMainView
23 23
24 24
25 25 def admin_routes(config):
26 26 """
27 27 Admin prefixed routes
28 28 """
29 29 from rhodecode.apps.admin.views.audit_logs import AdminAuditLogsView
30 30 from rhodecode.apps.admin.views.artifacts import AdminArtifactsView
31 31 from rhodecode.apps.admin.views.automation import AdminAutomationView
32 32 from rhodecode.apps.admin.views.scheduler import AdminSchedulerView
33 33 from rhodecode.apps.admin.views.defaults import AdminDefaultSettingsView
34 34 from rhodecode.apps.admin.views.exception_tracker import ExceptionsTrackerView
35 35 from rhodecode.apps.admin.views.open_source_licenses import OpenSourceLicensesAdminSettingsView
36 36 from rhodecode.apps.admin.views.permissions import AdminPermissionsView
37 37 from rhodecode.apps.admin.views.process_management import AdminProcessManagementView
38 38 from rhodecode.apps.admin.views.repo_groups import AdminRepoGroupsView
39 39 from rhodecode.apps.admin.views.repositories import AdminReposView
40 40 from rhodecode.apps.admin.views.sessions import AdminSessionSettingsView
41 41 from rhodecode.apps.admin.views.settings import AdminSettingsView
42 42 from rhodecode.apps.admin.views.svn_config import AdminSvnConfigView
43 43 from rhodecode.apps.admin.views.system_info import AdminSystemInfoSettingsView
44 44 from rhodecode.apps.admin.views.user_groups import AdminUserGroupsView
45 45 from rhodecode.apps.admin.views.users import AdminUsersView, UsersView
46 46 from rhodecode.apps.admin.views.security import AdminSecurityView
47 47
48 48 # Security EE feature
49 49
50 50 config.add_route(
51 51 'admin_security',
52 52 pattern='/security')
53 53 config.add_view(
54 54 AdminSecurityView,
55 55 attr='security',
56 56 route_name='admin_security', request_method='GET',
57 57 renderer='rhodecode:templates/admin/security/security.mako')
58 58
59 59 config.add_route(
60 60 name='admin_security_update',
61 61 pattern='/security/update')
62 62 config.add_view(
63 63 AdminSecurityView,
64 64 attr='security_update',
65 65 route_name='admin_security_update', request_method='POST',
66 66 renderer='rhodecode:templates/admin/security/security.mako')
67 67
68 68 config.add_route(
69 69 name='admin_security_modify_allowed_vcs_client_versions',
70 pattern='/security/modify/allowed_vcs_client_versions')
70 pattern=ADMIN_PREFIX + '/security/modify/allowed_vcs_client_versions')
71 71 config.add_view(
72 72 AdminSecurityView,
73 73 attr='vcs_whitelisted_client_versions_edit',
74 74 route_name='admin_security_modify_allowed_vcs_client_versions', request_method=('GET', 'POST'),
75 75 renderer='rhodecode:templates/admin/security/edit_allowed_vcs_client_versions.mako')
76 76
77 77
78 78 config.add_route(
79 79 name='admin_audit_logs',
80 80 pattern='/audit_logs')
81 81 config.add_view(
82 82 AdminAuditLogsView,
83 83 attr='admin_audit_logs',
84 84 route_name='admin_audit_logs', request_method='GET',
85 85 renderer='rhodecode:templates/admin/admin_audit_logs.mako')
86 86
87 87 config.add_route(
88 88 name='admin_audit_log_entry',
89 89 pattern='/audit_logs/{audit_log_id}')
90 90 config.add_view(
91 91 AdminAuditLogsView,
92 92 attr='admin_audit_log_entry',
93 93 route_name='admin_audit_log_entry', request_method='GET',
94 94 renderer='rhodecode:templates/admin/admin_audit_log_entry.mako')
95 95
96 96 # Artifacts EE feature
97 97 config.add_route(
98 98 'admin_artifacts',
99 99 pattern=ADMIN_PREFIX + '/artifacts')
100 100 config.add_route(
101 101 'admin_artifacts_show_all',
102 102 pattern=ADMIN_PREFIX + '/artifacts')
103 103 config.add_view(
104 104 AdminArtifactsView,
105 105 attr='artifacts',
106 106 route_name='admin_artifacts', request_method='GET',
107 107 renderer='rhodecode:templates/admin/artifacts/artifacts.mako')
108 108 config.add_view(
109 109 AdminArtifactsView,
110 110 attr='artifacts',
111 111 route_name='admin_artifacts_show_all', request_method='GET',
112 112 renderer='rhodecode:templates/admin/artifacts/artifacts.mako')
113 113
114 114 # EE views
115 115 config.add_route(
116 116 name='admin_artifacts_show_info',
117 117 pattern=ADMIN_PREFIX + '/artifacts/{uid}')
118 118 config.add_route(
119 119 name='admin_artifacts_delete',
120 120 pattern=ADMIN_PREFIX + '/artifacts/{uid}/delete')
121 121 config.add_route(
122 122 name='admin_artifacts_update',
123 123 pattern=ADMIN_PREFIX + '/artifacts/{uid}/update')
124 124
125 125 # Automation EE feature
126 126 config.add_route(
127 127 'admin_automation',
128 128 pattern=ADMIN_PREFIX + '/automation')
129 129 config.add_view(
130 130 AdminAutomationView,
131 131 attr='automation',
132 132 route_name='admin_automation', request_method='GET',
133 133 renderer='rhodecode:templates/admin/automation/automation.mako')
134 134
135 135 # Scheduler EE feature
136 136 config.add_route(
137 137 'admin_scheduler',
138 138 pattern=ADMIN_PREFIX + '/scheduler')
139 139 config.add_view(
140 140 AdminSchedulerView,
141 141 attr='scheduler',
142 142 route_name='admin_scheduler', request_method='GET',
143 143 renderer='rhodecode:templates/admin/scheduler/scheduler.mako')
144 144
145 145 config.add_route(
146 146 name='admin_settings_open_source',
147 147 pattern='/settings/open_source')
148 148 config.add_view(
149 149 OpenSourceLicensesAdminSettingsView,
150 150 attr='open_source_licenses',
151 151 route_name='admin_settings_open_source', request_method='GET',
152 152 renderer='rhodecode:templates/admin/settings/settings.mako')
153 153
154 154 config.add_route(
155 155 name='admin_settings_vcs_svn_generate_cfg',
156 156 pattern='/settings/vcs/svn_generate_cfg')
157 157 config.add_view(
158 158 AdminSvnConfigView,
159 159 attr='vcs_svn_generate_config',
160 160 route_name='admin_settings_vcs_svn_generate_cfg',
161 161 request_method='POST', renderer='json')
162 162
163 163 config.add_route(
164 164 name='admin_settings_system',
165 165 pattern='/settings/system')
166 166 config.add_view(
167 167 AdminSystemInfoSettingsView,
168 168 attr='settings_system_info',
169 169 route_name='admin_settings_system', request_method='GET',
170 170 renderer='rhodecode:templates/admin/settings/settings.mako')
171 171
172 172 config.add_route(
173 173 name='admin_settings_system_update',
174 174 pattern='/settings/system/updates')
175 175 config.add_view(
176 176 AdminSystemInfoSettingsView,
177 177 attr='settings_system_info_check_update',
178 178 route_name='admin_settings_system_update', request_method='GET',
179 179 renderer='rhodecode:templates/admin/settings/settings_system_update.mako')
180 180
181 181 config.add_route(
182 182 name='admin_settings_exception_tracker',
183 183 pattern='/settings/exceptions')
184 184 config.add_view(
185 185 ExceptionsTrackerView,
186 186 attr='browse_exceptions',
187 187 route_name='admin_settings_exception_tracker', request_method='GET',
188 188 renderer='rhodecode:templates/admin/settings/settings.mako')
189 189
190 190 config.add_route(
191 191 name='admin_settings_exception_tracker_delete_all',
192 192 pattern='/settings/exceptions_delete_all')
193 193 config.add_view(
194 194 ExceptionsTrackerView,
195 195 attr='exception_delete_all',
196 196 route_name='admin_settings_exception_tracker_delete_all', request_method='POST',
197 197 renderer='rhodecode:templates/admin/settings/settings.mako')
198 198
199 199 config.add_route(
200 200 name='admin_settings_exception_tracker_show',
201 201 pattern='/settings/exceptions/{exception_id}')
202 202 config.add_view(
203 203 ExceptionsTrackerView,
204 204 attr='exception_show',
205 205 route_name='admin_settings_exception_tracker_show', request_method='GET',
206 206 renderer='rhodecode:templates/admin/settings/settings.mako')
207 207
208 208 config.add_route(
209 209 name='admin_settings_exception_tracker_delete',
210 210 pattern='/settings/exceptions/{exception_id}/delete')
211 211 config.add_view(
212 212 ExceptionsTrackerView,
213 213 attr='exception_delete',
214 214 route_name='admin_settings_exception_tracker_delete', request_method='POST',
215 215 renderer='rhodecode:templates/admin/settings/settings.mako')
216 216
217 217 config.add_route(
218 218 name='admin_settings_sessions',
219 219 pattern='/settings/sessions')
220 220 config.add_view(
221 221 AdminSessionSettingsView,
222 222 attr='settings_sessions',
223 223 route_name='admin_settings_sessions', request_method='GET',
224 224 renderer='rhodecode:templates/admin/settings/settings.mako')
225 225
226 226 config.add_route(
227 227 name='admin_settings_sessions_cleanup',
228 228 pattern='/settings/sessions/cleanup')
229 229 config.add_view(
230 230 AdminSessionSettingsView,
231 231 attr='settings_sessions_cleanup',
232 232 route_name='admin_settings_sessions_cleanup', request_method='POST')
233 233
234 234 config.add_route(
235 235 name='admin_settings_process_management',
236 236 pattern='/settings/process_management')
237 237 config.add_view(
238 238 AdminProcessManagementView,
239 239 attr='process_management',
240 240 route_name='admin_settings_process_management', request_method='GET',
241 241 renderer='rhodecode:templates/admin/settings/settings.mako')
242 242
243 243 config.add_route(
244 244 name='admin_settings_process_management_data',
245 245 pattern='/settings/process_management/data')
246 246 config.add_view(
247 247 AdminProcessManagementView,
248 248 attr='process_management_data',
249 249 route_name='admin_settings_process_management_data', request_method='GET',
250 250 renderer='rhodecode:templates/admin/settings/settings_process_management_data.mako')
251 251
252 252 config.add_route(
253 253 name='admin_settings_process_management_signal',
254 254 pattern='/settings/process_management/signal')
255 255 config.add_view(
256 256 AdminProcessManagementView,
257 257 attr='process_management_signal',
258 258 route_name='admin_settings_process_management_signal',
259 259 request_method='POST', renderer='json_ext')
260 260
261 261 config.add_route(
262 262 name='admin_settings_process_management_master_signal',
263 263 pattern='/settings/process_management/master_signal')
264 264 config.add_view(
265 265 AdminProcessManagementView,
266 266 attr='process_management_master_signal',
267 267 route_name='admin_settings_process_management_master_signal',
268 268 request_method='POST', renderer='json_ext')
269 269
270 270 # default settings
271 271 config.add_route(
272 272 name='admin_defaults_repositories',
273 273 pattern='/defaults/repositories')
274 274 config.add_view(
275 275 AdminDefaultSettingsView,
276 276 attr='defaults_repository_show',
277 277 route_name='admin_defaults_repositories', request_method='GET',
278 278 renderer='rhodecode:templates/admin/defaults/defaults.mako')
279 279
280 280 config.add_route(
281 281 name='admin_defaults_repositories_update',
282 282 pattern='/defaults/repositories/update')
283 283 config.add_view(
284 284 AdminDefaultSettingsView,
285 285 attr='defaults_repository_update',
286 286 route_name='admin_defaults_repositories_update', request_method='POST',
287 287 renderer='rhodecode:templates/admin/defaults/defaults.mako')
288 288
289 289 # admin settings
290 290
291 291 config.add_route(
292 292 name='admin_settings',
293 293 pattern='/settings')
294 294 config.add_view(
295 295 AdminSettingsView,
296 296 attr='settings_global',
297 297 route_name='admin_settings', request_method='GET',
298 298 renderer='rhodecode:templates/admin/settings/settings.mako')
299 299
300 300 config.add_route(
301 301 name='admin_settings_update',
302 302 pattern='/settings/update')
303 303 config.add_view(
304 304 AdminSettingsView,
305 305 attr='settings_global_update',
306 306 route_name='admin_settings_update', request_method='POST',
307 307 renderer='rhodecode:templates/admin/settings/settings.mako')
308 308
309 309 config.add_route(
310 310 name='admin_settings_global',
311 311 pattern='/settings/global')
312 312 config.add_view(
313 313 AdminSettingsView,
314 314 attr='settings_global',
315 315 route_name='admin_settings_global', request_method='GET',
316 316 renderer='rhodecode:templates/admin/settings/settings.mako')
317 317
318 318 config.add_route(
319 319 name='admin_settings_global_update',
320 320 pattern='/settings/global/update')
321 321 config.add_view(
322 322 AdminSettingsView,
323 323 attr='settings_global_update',
324 324 route_name='admin_settings_global_update', request_method='POST',
325 325 renderer='rhodecode:templates/admin/settings/settings.mako')
326 326
327 327 config.add_route(
328 328 name='admin_settings_vcs',
329 329 pattern='/settings/vcs')
330 330 config.add_view(
331 331 AdminSettingsView,
332 332 attr='settings_vcs',
333 333 route_name='admin_settings_vcs', request_method='GET',
334 334 renderer='rhodecode:templates/admin/settings/settings.mako')
335 335
336 336 config.add_route(
337 337 name='admin_settings_vcs_update',
338 338 pattern='/settings/vcs/update')
339 339 config.add_view(
340 340 AdminSettingsView,
341 341 attr='settings_vcs_update',
342 342 route_name='admin_settings_vcs_update', request_method='POST',
343 343 renderer='rhodecode:templates/admin/settings/settings.mako')
344 344
345 345 config.add_route(
346 346 name='admin_settings_vcs_svn_pattern_delete',
347 347 pattern='/settings/vcs/svn_pattern_delete')
348 348 config.add_view(
349 349 AdminSettingsView,
350 350 attr='settings_vcs_delete_svn_pattern',
351 351 route_name='admin_settings_vcs_svn_pattern_delete', request_method='POST',
352 352 renderer='json_ext', xhr=True)
353 353
354 354 config.add_route(
355 355 name='admin_settings_mapping',
356 356 pattern='/settings/mapping')
357 357 config.add_view(
358 358 AdminSettingsView,
359 359 attr='settings_mapping',
360 360 route_name='admin_settings_mapping', request_method='GET',
361 361 renderer='rhodecode:templates/admin/settings/settings.mako')
362 362
363 363 config.add_route(
364 364 name='admin_settings_mapping_update',
365 365 pattern='/settings/mapping/update')
366 366 config.add_view(
367 367 AdminSettingsView,
368 368 attr='settings_mapping_update',
369 369 route_name='admin_settings_mapping_update', request_method='POST',
370 370 renderer='rhodecode:templates/admin/settings/settings.mako')
371 371
372 372 config.add_route(
373 373 name='admin_settings_visual',
374 374 pattern='/settings/visual')
375 375 config.add_view(
376 376 AdminSettingsView,
377 377 attr='settings_visual',
378 378 route_name='admin_settings_visual', request_method='GET',
379 379 renderer='rhodecode:templates/admin/settings/settings.mako')
380 380
381 381 config.add_route(
382 382 name='admin_settings_visual_update',
383 383 pattern='/settings/visual/update')
384 384 config.add_view(
385 385 AdminSettingsView,
386 386 attr='settings_visual_update',
387 387 route_name='admin_settings_visual_update', request_method='POST',
388 388 renderer='rhodecode:templates/admin/settings/settings.mako')
389 389
390 390 config.add_route(
391 391 name='admin_settings_issuetracker',
392 392 pattern='/settings/issue-tracker')
393 393 config.add_view(
394 394 AdminSettingsView,
395 395 attr='settings_issuetracker',
396 396 route_name='admin_settings_issuetracker', request_method='GET',
397 397 renderer='rhodecode:templates/admin/settings/settings.mako')
398 398
399 399 config.add_route(
400 400 name='admin_settings_issuetracker_update',
401 401 pattern='/settings/issue-tracker/update')
402 402 config.add_view(
403 403 AdminSettingsView,
404 404 attr='settings_issuetracker_update',
405 405 route_name='admin_settings_issuetracker_update', request_method='POST',
406 406 renderer='rhodecode:templates/admin/settings/settings.mako')
407 407
408 408 config.add_route(
409 409 name='admin_settings_issuetracker_test',
410 410 pattern='/settings/issue-tracker/test')
411 411 config.add_view(
412 412 AdminSettingsView,
413 413 attr='settings_issuetracker_test',
414 414 route_name='admin_settings_issuetracker_test', request_method='POST',
415 415 renderer='string', xhr=True)
416 416
417 417 config.add_route(
418 418 name='admin_settings_issuetracker_delete',
419 419 pattern='/settings/issue-tracker/delete')
420 420 config.add_view(
421 421 AdminSettingsView,
422 422 attr='settings_issuetracker_delete',
423 423 route_name='admin_settings_issuetracker_delete', request_method='POST',
424 424 renderer='json_ext', xhr=True)
425 425
426 426 config.add_route(
427 427 name='admin_settings_email',
428 428 pattern='/settings/email')
429 429 config.add_view(
430 430 AdminSettingsView,
431 431 attr='settings_email',
432 432 route_name='admin_settings_email', request_method='GET',
433 433 renderer='rhodecode:templates/admin/settings/settings.mako')
434 434
435 435 config.add_route(
436 436 name='admin_settings_email_update',
437 437 pattern='/settings/email/update')
438 438 config.add_view(
439 439 AdminSettingsView,
440 440 attr='settings_email_update',
441 441 route_name='admin_settings_email_update', request_method='POST',
442 442 renderer='rhodecode:templates/admin/settings/settings.mako')
443 443
444 444 config.add_route(
445 445 name='admin_settings_hooks',
446 446 pattern='/settings/hooks')
447 447 config.add_view(
448 448 AdminSettingsView,
449 449 attr='settings_hooks',
450 450 route_name='admin_settings_hooks', request_method='GET',
451 451 renderer='rhodecode:templates/admin/settings/settings.mako')
452 452
453 453 config.add_route(
454 454 name='admin_settings_hooks_update',
455 455 pattern='/settings/hooks/update')
456 456 config.add_view(
457 457 AdminSettingsView,
458 458 attr='settings_hooks_update',
459 459 route_name='admin_settings_hooks_update', request_method='POST',
460 460 renderer='rhodecode:templates/admin/settings/settings.mako')
461 461
462 462 config.add_route(
463 463 name='admin_settings_hooks_delete',
464 464 pattern='/settings/hooks/delete')
465 465 config.add_view(
466 466 AdminSettingsView,
467 467 attr='settings_hooks_update',
468 468 route_name='admin_settings_hooks_delete', request_method='POST',
469 469 renderer='rhodecode:templates/admin/settings/settings.mako')
470 470
471 471 config.add_route(
472 472 name='admin_settings_search',
473 473 pattern='/settings/search')
474 474 config.add_view(
475 475 AdminSettingsView,
476 476 attr='settings_search',
477 477 route_name='admin_settings_search', request_method='GET',
478 478 renderer='rhodecode:templates/admin/settings/settings.mako')
479 479
480 480 config.add_route(
481 481 name='admin_settings_labs',
482 482 pattern='/settings/labs')
483 483 config.add_view(
484 484 AdminSettingsView,
485 485 attr='settings_labs',
486 486 route_name='admin_settings_labs', request_method='GET',
487 487 renderer='rhodecode:templates/admin/settings/settings.mako')
488 488
489 489 config.add_route(
490 490 name='admin_settings_labs_update',
491 491 pattern='/settings/labs/update')
492 492 config.add_view(
493 493 AdminSettingsView,
494 494 attr='settings_labs_update',
495 495 route_name='admin_settings_labs_update', request_method='POST',
496 496 renderer='rhodecode:templates/admin/settings/settings.mako')
497 497
498 498 # global permissions
499 499
500 500 config.add_route(
501 501 name='admin_permissions_application',
502 502 pattern='/permissions/application')
503 503 config.add_view(
504 504 AdminPermissionsView,
505 505 attr='permissions_application',
506 506 route_name='admin_permissions_application', request_method='GET',
507 507 renderer='rhodecode:templates/admin/permissions/permissions.mako')
508 508
509 509 config.add_route(
510 510 name='admin_permissions_application_update',
511 511 pattern='/permissions/application/update')
512 512 config.add_view(
513 513 AdminPermissionsView,
514 514 attr='permissions_application_update',
515 515 route_name='admin_permissions_application_update', request_method='POST',
516 516 renderer='rhodecode:templates/admin/permissions/permissions.mako')
517 517
518 518 config.add_route(
519 519 name='admin_permissions_global',
520 520 pattern='/permissions/global')
521 521 config.add_view(
522 522 AdminPermissionsView,
523 523 attr='permissions_global',
524 524 route_name='admin_permissions_global', request_method='GET',
525 525 renderer='rhodecode:templates/admin/permissions/permissions.mako')
526 526
527 527 config.add_route(
528 528 name='admin_permissions_global_update',
529 529 pattern='/permissions/global/update')
530 530 config.add_view(
531 531 AdminPermissionsView,
532 532 attr='permissions_global_update',
533 533 route_name='admin_permissions_global_update', request_method='POST',
534 534 renderer='rhodecode:templates/admin/permissions/permissions.mako')
535 535
536 536 config.add_route(
537 537 name='admin_permissions_object',
538 538 pattern='/permissions/object')
539 539 config.add_view(
540 540 AdminPermissionsView,
541 541 attr='permissions_objects',
542 542 route_name='admin_permissions_object', request_method='GET',
543 543 renderer='rhodecode:templates/admin/permissions/permissions.mako')
544 544
545 545 config.add_route(
546 546 name='admin_permissions_object_update',
547 547 pattern='/permissions/object/update')
548 548 config.add_view(
549 549 AdminPermissionsView,
550 550 attr='permissions_objects_update',
551 551 route_name='admin_permissions_object_update', request_method='POST',
552 552 renderer='rhodecode:templates/admin/permissions/permissions.mako')
553 553
554 554 # Branch perms EE feature
555 555 config.add_route(
556 556 name='admin_permissions_branch',
557 557 pattern='/permissions/branch')
558 558 config.add_view(
559 559 AdminPermissionsView,
560 560 attr='permissions_branch',
561 561 route_name='admin_permissions_branch', request_method='GET',
562 562 renderer='rhodecode:templates/admin/permissions/permissions.mako')
563 563
564 564 config.add_route(
565 565 name='admin_permissions_ips',
566 566 pattern='/permissions/ips')
567 567 config.add_view(
568 568 AdminPermissionsView,
569 569 attr='permissions_ips',
570 570 route_name='admin_permissions_ips', request_method='GET',
571 571 renderer='rhodecode:templates/admin/permissions/permissions.mako')
572 572
573 573 config.add_route(
574 574 name='admin_permissions_overview',
575 575 pattern='/permissions/overview')
576 576 config.add_view(
577 577 AdminPermissionsView,
578 578 attr='permissions_overview',
579 579 route_name='admin_permissions_overview', request_method='GET',
580 580 renderer='rhodecode:templates/admin/permissions/permissions.mako')
581 581
582 582 config.add_route(
583 583 name='admin_permissions_auth_token_access',
584 584 pattern='/permissions/auth_token_access')
585 585 config.add_view(
586 586 AdminPermissionsView,
587 587 attr='auth_token_access',
588 588 route_name='admin_permissions_auth_token_access', request_method='GET',
589 589 renderer='rhodecode:templates/admin/permissions/permissions.mako')
590 590
591 591 config.add_route(
592 592 name='admin_permissions_ssh_keys',
593 593 pattern='/permissions/ssh_keys')
594 594 config.add_view(
595 595 AdminPermissionsView,
596 596 attr='ssh_keys',
597 597 route_name='admin_permissions_ssh_keys', request_method='GET',
598 598 renderer='rhodecode:templates/admin/permissions/permissions.mako')
599 599
600 600 config.add_route(
601 601 name='admin_permissions_ssh_keys_data',
602 602 pattern='/permissions/ssh_keys/data')
603 603 config.add_view(
604 604 AdminPermissionsView,
605 605 attr='ssh_keys_data',
606 606 route_name='admin_permissions_ssh_keys_data', request_method='GET',
607 607 renderer='json_ext', xhr=True)
608 608
609 609 config.add_route(
610 610 name='admin_permissions_ssh_keys_update',
611 611 pattern='/permissions/ssh_keys/update')
612 612 config.add_view(
613 613 AdminPermissionsView,
614 614 attr='ssh_keys_update',
615 615 route_name='admin_permissions_ssh_keys_update', request_method='POST',
616 616 renderer='rhodecode:templates/admin/permissions/permissions.mako')
617 617
618 618 # users admin
619 619 config.add_route(
620 620 name='users',
621 621 pattern='/users')
622 622 config.add_view(
623 623 AdminUsersView,
624 624 attr='users_list',
625 625 route_name='users', request_method='GET',
626 626 renderer='rhodecode:templates/admin/users/users.mako')
627 627
628 628 config.add_route(
629 629 name='users_data',
630 630 pattern='/users_data')
631 631 config.add_view(
632 632 AdminUsersView,
633 633 attr='users_list_data',
634 634 # renderer defined below
635 635 route_name='users_data', request_method='GET',
636 636 renderer='json_ext', xhr=True)
637 637
638 638 config.add_route(
639 639 name='users_create',
640 640 pattern='/users/create')
641 641 config.add_view(
642 642 AdminUsersView,
643 643 attr='users_create',
644 644 route_name='users_create', request_method='POST',
645 645 renderer='rhodecode:templates/admin/users/user_add.mako')
646 646
647 647 config.add_route(
648 648 name='users_new',
649 649 pattern='/users/new')
650 650 config.add_view(
651 651 AdminUsersView,
652 652 attr='users_new',
653 653 route_name='users_new', request_method='GET',
654 654 renderer='rhodecode:templates/admin/users/user_add.mako')
655 655
656 656 # user management
657 657 config.add_route(
658 658 name='user_edit',
659 659 pattern=r'/users/{user_id:\d+}/edit',
660 660 user_route=True)
661 661 config.add_view(
662 662 UsersView,
663 663 attr='user_edit',
664 664 route_name='user_edit', request_method='GET',
665 665 renderer='rhodecode:templates/admin/users/user_edit.mako')
666 666
667 667 config.add_route(
668 668 name='user_edit_advanced',
669 669 pattern=r'/users/{user_id:\d+}/edit/advanced',
670 670 user_route=True)
671 671 config.add_view(
672 672 UsersView,
673 673 attr='user_edit_advanced',
674 674 route_name='user_edit_advanced', request_method='GET',
675 675 renderer='rhodecode:templates/admin/users/user_edit.mako')
676 676
677 677 config.add_route(
678 678 name='user_edit_global_perms',
679 679 pattern=r'/users/{user_id:\d+}/edit/global_permissions',
680 680 user_route=True)
681 681 config.add_view(
682 682 UsersView,
683 683 attr='user_edit_global_perms',
684 684 route_name='user_edit_global_perms', request_method='GET',
685 685 renderer='rhodecode:templates/admin/users/user_edit.mako')
686 686
687 687 config.add_route(
688 688 name='user_edit_global_perms_update',
689 689 pattern=r'/users/{user_id:\d+}/edit/global_permissions/update',
690 690 user_route=True)
691 691 config.add_view(
692 692 UsersView,
693 693 attr='user_edit_global_perms_update',
694 694 route_name='user_edit_global_perms_update', request_method='POST',
695 695 renderer='rhodecode:templates/admin/users/user_edit.mako')
696 696
697 697 config.add_route(
698 698 name='user_update',
699 699 pattern=r'/users/{user_id:\d+}/update',
700 700 user_route=True)
701 701 config.add_view(
702 702 UsersView,
703 703 attr='user_update',
704 704 route_name='user_update', request_method='POST',
705 705 renderer='rhodecode:templates/admin/users/user_edit.mako')
706 706
707 707 config.add_route(
708 708 name='user_delete',
709 709 pattern=r'/users/{user_id:\d+}/delete',
710 710 user_route=True)
711 711 config.add_view(
712 712 UsersView,
713 713 attr='user_delete',
714 714 route_name='user_delete', request_method='POST',
715 715 renderer='rhodecode:templates/admin/users/user_edit.mako')
716 716
717 717 config.add_route(
718 718 name='user_enable_force_password_reset',
719 719 pattern=r'/users/{user_id:\d+}/password_reset_enable',
720 720 user_route=True)
721 721 config.add_view(
722 722 UsersView,
723 723 attr='user_enable_force_password_reset',
724 724 route_name='user_enable_force_password_reset', request_method='POST',
725 725 renderer='rhodecode:templates/admin/users/user_edit.mako')
726 726
727 727 config.add_route(
728 728 name='user_disable_force_password_reset',
729 729 pattern=r'/users/{user_id:\d+}/password_reset_disable',
730 730 user_route=True)
731 731 config.add_view(
732 732 UsersView,
733 733 attr='user_disable_force_password_reset',
734 734 route_name='user_disable_force_password_reset', request_method='POST',
735 735 renderer='rhodecode:templates/admin/users/user_edit.mako')
736 736
737 737 config.add_route(
738 738 name='user_create_personal_repo_group',
739 739 pattern=r'/users/{user_id:\d+}/create_repo_group',
740 740 user_route=True)
741 741 config.add_view(
742 742 UsersView,
743 743 attr='user_create_personal_repo_group',
744 744 route_name='user_create_personal_repo_group', request_method='POST',
745 745 renderer='rhodecode:templates/admin/users/user_edit.mako')
746 746
747 747 # user notice
748 748 config.add_route(
749 749 name='user_notice_dismiss',
750 750 pattern=r'/users/{user_id:\d+}/notice_dismiss',
751 751 user_route=True)
752 752 config.add_view(
753 753 UsersView,
754 754 attr='user_notice_dismiss',
755 755 route_name='user_notice_dismiss', request_method='POST',
756 756 renderer='json_ext', xhr=True)
757 757
758 758 # user auth tokens
759 759 config.add_route(
760 760 name='edit_user_auth_tokens',
761 761 pattern=r'/users/{user_id:\d+}/edit/auth_tokens',
762 762 user_route=True)
763 763 config.add_view(
764 764 UsersView,
765 765 attr='auth_tokens',
766 766 route_name='edit_user_auth_tokens', request_method='GET',
767 767 renderer='rhodecode:templates/admin/users/user_edit.mako')
768 768
769 769 config.add_route(
770 770 name='edit_user_auth_tokens_view',
771 771 pattern=r'/users/{user_id:\d+}/edit/auth_tokens/view',
772 772 user_route=True)
773 773 config.add_view(
774 774 UsersView,
775 775 attr='auth_tokens_view',
776 776 route_name='edit_user_auth_tokens_view', request_method='POST',
777 777 renderer='json_ext', xhr=True)
778 778
779 779 config.add_route(
780 780 name='edit_user_auth_tokens_add',
781 781 pattern=r'/users/{user_id:\d+}/edit/auth_tokens/new',
782 782 user_route=True)
783 783 config.add_view(
784 784 UsersView,
785 785 attr='auth_tokens_add',
786 786 route_name='edit_user_auth_tokens_add', request_method='POST')
787 787
788 788 config.add_route(
789 789 name='edit_user_auth_tokens_delete',
790 790 pattern=r'/users/{user_id:\d+}/edit/auth_tokens/delete',
791 791 user_route=True)
792 792 config.add_view(
793 793 UsersView,
794 794 attr='auth_tokens_delete',
795 795 route_name='edit_user_auth_tokens_delete', request_method='POST')
796 796
797 797 # user ssh keys
798 798 config.add_route(
799 799 name='edit_user_ssh_keys',
800 800 pattern=r'/users/{user_id:\d+}/edit/ssh_keys',
801 801 user_route=True)
802 802 config.add_view(
803 803 UsersView,
804 804 attr='ssh_keys',
805 805 route_name='edit_user_ssh_keys', request_method='GET',
806 806 renderer='rhodecode:templates/admin/users/user_edit.mako')
807 807
808 808 config.add_route(
809 809 name='edit_user_ssh_keys_generate_keypair',
810 810 pattern=r'/users/{user_id:\d+}/edit/ssh_keys/generate',
811 811 user_route=True)
812 812 config.add_view(
813 813 UsersView,
814 814 attr='ssh_keys_generate_keypair',
815 815 route_name='edit_user_ssh_keys_generate_keypair', request_method='GET',
816 816 renderer='rhodecode:templates/admin/users/user_edit.mako')
817 817
818 818 config.add_route(
819 819 name='edit_user_ssh_keys_add',
820 820 pattern=r'/users/{user_id:\d+}/edit/ssh_keys/new',
821 821 user_route=True)
822 822 config.add_view(
823 823 UsersView,
824 824 attr='ssh_keys_add',
825 825 route_name='edit_user_ssh_keys_add', request_method='POST')
826 826
827 827 config.add_route(
828 828 name='edit_user_ssh_keys_delete',
829 829 pattern=r'/users/{user_id:\d+}/edit/ssh_keys/delete',
830 830 user_route=True)
831 831 config.add_view(
832 832 UsersView,
833 833 attr='ssh_keys_delete',
834 834 route_name='edit_user_ssh_keys_delete', request_method='POST')
835 835
836 836 # user emails
837 837 config.add_route(
838 838 name='edit_user_emails',
839 839 pattern=r'/users/{user_id:\d+}/edit/emails',
840 840 user_route=True)
841 841 config.add_view(
842 842 UsersView,
843 843 attr='emails',
844 844 route_name='edit_user_emails', request_method='GET',
845 845 renderer='rhodecode:templates/admin/users/user_edit.mako')
846 846
847 847 config.add_route(
848 848 name='edit_user_emails_add',
849 849 pattern=r'/users/{user_id:\d+}/edit/emails/new',
850 850 user_route=True)
851 851 config.add_view(
852 852 UsersView,
853 853 attr='emails_add',
854 854 route_name='edit_user_emails_add', request_method='POST')
855 855
856 856 config.add_route(
857 857 name='edit_user_emails_delete',
858 858 pattern=r'/users/{user_id:\d+}/edit/emails/delete',
859 859 user_route=True)
860 860 config.add_view(
861 861 UsersView,
862 862 attr='emails_delete',
863 863 route_name='edit_user_emails_delete', request_method='POST')
864 864
865 865 # user IPs
866 866 config.add_route(
867 867 name='edit_user_ips',
868 868 pattern=r'/users/{user_id:\d+}/edit/ips',
869 869 user_route=True)
870 870 config.add_view(
871 871 UsersView,
872 872 attr='ips',
873 873 route_name='edit_user_ips', request_method='GET',
874 874 renderer='rhodecode:templates/admin/users/user_edit.mako')
875 875
876 876 config.add_route(
877 877 name='edit_user_ips_add',
878 878 pattern=r'/users/{user_id:\d+}/edit/ips/new',
879 879 user_route_with_default=True) # enabled for default user too
880 880 config.add_view(
881 881 UsersView,
882 882 attr='ips_add',
883 883 route_name='edit_user_ips_add', request_method='POST')
884 884
885 885 config.add_route(
886 886 name='edit_user_ips_delete',
887 887 pattern=r'/users/{user_id:\d+}/edit/ips/delete',
888 888 user_route_with_default=True) # enabled for default user too
889 889 config.add_view(
890 890 UsersView,
891 891 attr='ips_delete',
892 892 route_name='edit_user_ips_delete', request_method='POST')
893 893
894 894 # user perms
895 895 config.add_route(
896 896 name='edit_user_perms_summary',
897 897 pattern=r'/users/{user_id:\d+}/edit/permissions_summary',
898 898 user_route=True)
899 899 config.add_view(
900 900 UsersView,
901 901 attr='user_perms_summary',
902 902 route_name='edit_user_perms_summary', request_method='GET',
903 903 renderer='rhodecode:templates/admin/users/user_edit.mako')
904 904
905 905 config.add_route(
906 906 name='edit_user_perms_summary_json',
907 907 pattern=r'/users/{user_id:\d+}/edit/permissions_summary/json',
908 908 user_route=True)
909 909 config.add_view(
910 910 UsersView,
911 911 attr='user_perms_summary_json',
912 912 route_name='edit_user_perms_summary_json', request_method='GET',
913 913 renderer='json_ext')
914 914
915 915 # user user groups management
916 916 config.add_route(
917 917 name='edit_user_groups_management',
918 918 pattern=r'/users/{user_id:\d+}/edit/groups_management',
919 919 user_route=True)
920 920 config.add_view(
921 921 UsersView,
922 922 attr='groups_management',
923 923 route_name='edit_user_groups_management', request_method='GET',
924 924 renderer='rhodecode:templates/admin/users/user_edit.mako')
925 925
926 926 config.add_route(
927 927 name='edit_user_groups_management_updates',
928 928 pattern=r'/users/{user_id:\d+}/edit/edit_user_groups_management/updates',
929 929 user_route=True)
930 930 config.add_view(
931 931 UsersView,
932 932 attr='groups_management_updates',
933 933 route_name='edit_user_groups_management_updates', request_method='POST')
934 934
935 935 # user audit logs
936 936 config.add_route(
937 937 name='edit_user_audit_logs',
938 938 pattern=r'/users/{user_id:\d+}/edit/audit', user_route=True)
939 939 config.add_view(
940 940 UsersView,
941 941 attr='user_audit_logs',
942 942 route_name='edit_user_audit_logs', request_method='GET',
943 943 renderer='rhodecode:templates/admin/users/user_edit.mako')
944 944
945 945 config.add_route(
946 946 name='edit_user_audit_logs_download',
947 947 pattern=r'/users/{user_id:\d+}/edit/audit/download', user_route=True)
948 948 config.add_view(
949 949 UsersView,
950 950 attr='user_audit_logs_download',
951 951 route_name='edit_user_audit_logs_download', request_method='GET',
952 952 renderer='string')
953 953
954 954 # user caches
955 955 config.add_route(
956 956 name='edit_user_caches',
957 957 pattern=r'/users/{user_id:\d+}/edit/caches',
958 958 user_route=True)
959 959 config.add_view(
960 960 UsersView,
961 961 attr='user_caches',
962 962 route_name='edit_user_caches', request_method='GET',
963 963 renderer='rhodecode:templates/admin/users/user_edit.mako')
964 964
965 965 config.add_route(
966 966 name='edit_user_caches_update',
967 967 pattern=r'/users/{user_id:\d+}/edit/caches/update',
968 968 user_route=True)
969 969 config.add_view(
970 970 UsersView,
971 971 attr='user_caches_update',
972 972 route_name='edit_user_caches_update', request_method='POST')
973 973
974 974 # user-groups admin
975 975 config.add_route(
976 976 name='user_groups',
977 977 pattern='/user_groups')
978 978 config.add_view(
979 979 AdminUserGroupsView,
980 980 attr='user_groups_list',
981 981 route_name='user_groups', request_method='GET',
982 982 renderer='rhodecode:templates/admin/user_groups/user_groups.mako')
983 983
984 984 config.add_route(
985 985 name='user_groups_data',
986 986 pattern='/user_groups_data')
987 987 config.add_view(
988 988 AdminUserGroupsView,
989 989 attr='user_groups_list_data',
990 990 route_name='user_groups_data', request_method='GET',
991 991 renderer='json_ext', xhr=True)
992 992
993 993 config.add_route(
994 994 name='user_groups_new',
995 995 pattern='/user_groups/new')
996 996 config.add_view(
997 997 AdminUserGroupsView,
998 998 attr='user_groups_new',
999 999 route_name='user_groups_new', request_method='GET',
1000 1000 renderer='rhodecode:templates/admin/user_groups/user_group_add.mako')
1001 1001
1002 1002 config.add_route(
1003 1003 name='user_groups_create',
1004 1004 pattern='/user_groups/create')
1005 1005 config.add_view(
1006 1006 AdminUserGroupsView,
1007 1007 attr='user_groups_create',
1008 1008 route_name='user_groups_create', request_method='POST',
1009 1009 renderer='rhodecode:templates/admin/user_groups/user_group_add.mako')
1010 1010
1011 1011 # repos admin
1012 1012 config.add_route(
1013 1013 name='repos',
1014 1014 pattern='/repos')
1015 1015 config.add_view(
1016 1016 AdminReposView,
1017 1017 attr='repository_list',
1018 1018 route_name='repos', request_method='GET',
1019 1019 renderer='rhodecode:templates/admin/repos/repos.mako')
1020 1020
1021 1021 config.add_route(
1022 1022 name='repos_data',
1023 1023 pattern='/repos_data')
1024 1024 config.add_view(
1025 1025 AdminReposView,
1026 1026 attr='repository_list_data',
1027 1027 route_name='repos_data', request_method='GET',
1028 1028 renderer='json_ext', xhr=True)
1029 1029
1030 1030 config.add_route(
1031 1031 name='repo_new',
1032 1032 pattern='/repos/new')
1033 1033 config.add_view(
1034 1034 AdminReposView,
1035 1035 attr='repository_new',
1036 1036 route_name='repo_new', request_method='GET',
1037 1037 renderer='rhodecode:templates/admin/repos/repo_add.mako')
1038 1038
1039 1039 config.add_route(
1040 1040 name='repo_create',
1041 1041 pattern='/repos/create')
1042 1042 config.add_view(
1043 1043 AdminReposView,
1044 1044 attr='repository_create',
1045 1045 route_name='repo_create', request_method='POST',
1046 1046 renderer='rhodecode:templates/admin/repos/repos.mako')
1047 1047
1048 1048 # repo groups admin
1049 1049 config.add_route(
1050 1050 name='repo_groups',
1051 1051 pattern='/repo_groups')
1052 1052 config.add_view(
1053 1053 AdminRepoGroupsView,
1054 1054 attr='repo_group_list',
1055 1055 route_name='repo_groups', request_method='GET',
1056 1056 renderer='rhodecode:templates/admin/repo_groups/repo_groups.mako')
1057 1057
1058 1058 config.add_route(
1059 1059 name='repo_groups_data',
1060 1060 pattern='/repo_groups_data')
1061 1061 config.add_view(
1062 1062 AdminRepoGroupsView,
1063 1063 attr='repo_group_list_data',
1064 1064 route_name='repo_groups_data', request_method='GET',
1065 1065 renderer='json_ext', xhr=True)
1066 1066
1067 1067 config.add_route(
1068 1068 name='repo_group_new',
1069 1069 pattern='/repo_group/new')
1070 1070 config.add_view(
1071 1071 AdminRepoGroupsView,
1072 1072 attr='repo_group_new',
1073 1073 route_name='repo_group_new', request_method='GET',
1074 1074 renderer='rhodecode:templates/admin/repo_groups/repo_group_add.mako')
1075 1075
1076 1076 config.add_route(
1077 1077 name='repo_group_create',
1078 1078 pattern='/repo_group/create')
1079 1079 config.add_view(
1080 1080 AdminRepoGroupsView,
1081 1081 attr='repo_group_create',
1082 1082 route_name='repo_group_create', request_method='POST',
1083 1083 renderer='rhodecode:templates/admin/repo_groups/repo_group_add.mako')
1084 1084
1085 1085
1086 1086 def includeme(config):
1087 1087 # Create admin navigation registry and add it to the pyramid registry.
1088 1088 nav_includeme(config)
1089 1089
1090 1090 # main admin routes
1091 1091 config.add_route(
1092 1092 name='admin_home', pattern=ADMIN_PREFIX)
1093 1093 config.add_view(
1094 1094 AdminMainView,
1095 1095 attr='admin_main',
1096 1096 route_name='admin_home', request_method='GET',
1097 1097 renderer='rhodecode:templates/admin/main.mako')
1098 1098
1099 1099 # pr global redirect
1100 1100 config.add_route(
1101 1101 name='pull_requests_global_0', # backward compat
1102 1102 pattern=ADMIN_PREFIX + r'/pull_requests/{pull_request_id:\d+}')
1103 1103 config.add_view(
1104 1104 AdminMainView,
1105 1105 attr='pull_requests',
1106 1106 route_name='pull_requests_global_0', request_method='GET')
1107 1107
1108 1108 config.add_route(
1109 1109 name='pull_requests_global_1', # backward compat
1110 1110 pattern=ADMIN_PREFIX + r'/pull-requests/{pull_request_id:\d+}')
1111 1111 config.add_view(
1112 1112 AdminMainView,
1113 1113 attr='pull_requests',
1114 1114 route_name='pull_requests_global_1', request_method='GET')
1115 1115
1116 1116 config.add_route(
1117 1117 name='pull_requests_global',
1118 1118 pattern=ADMIN_PREFIX + r'/pull-request/{pull_request_id:\d+}')
1119 1119 config.add_view(
1120 1120 AdminMainView,
1121 1121 attr='pull_requests',
1122 1122 route_name='pull_requests_global', request_method='GET')
1123 1123
1124 1124 config.include(admin_routes, route_prefix=ADMIN_PREFIX)
General Comments 0
You need to be logged in to leave comments. Login now