22
22
BurpRawRequestResponse , Endpoint , Notes , JIRA_PKey , JIRA_Conf , \
23
23
JIRA_Issue , Tool_Product_Settings , Tool_Configuration , Tool_Type , \
24
24
Languages , Language_Type , App_Analysis
25
- from dojo .forms import ProductForm , EngForm2 , TestForm , \
25
+ from dojo .forms import ProductForm , EngForm , TestForm , \
26
26
ScanSettingsForm , FindingForm , StubFindingForm , FindingTemplateForm , \
27
27
ImportScanForm , SEVERITY_CHOICES , JIRAForm , JIRA_PKeyForm , EditEndpointForm , \
28
28
JIRA_IssueForm , ToolConfigForm , ToolProductSettingsForm , \
@@ -391,6 +391,78 @@ def obj_update(self, bundle, request=None, **kwargs):
391
391
return bundle
392
392
393
393
394
+ """
395
+ /api/v1/tool_configurations/
396
+ GET [/id/], DELETE [/id/]
397
+ Expects: no params or id
398
+ Returns Tool_ConfigurationResource
399
+ Relevant apply filter ?test_type=?, ?id=?
400
+
401
+ POST, PUT, DLETE [/id/]
402
+ """
403
+
404
+
405
+ class Tool_TypeResource (BaseModelResource ):
406
+
407
+ class Meta :
408
+ resource_name = 'tool_types'
409
+ list_allowed_methods = ['get' , 'post' , 'put' , 'delete' ]
410
+ detail_allowed_methods = ['get' , 'post' , 'put' , 'delete' ]
411
+ queryset = Tool_Type .objects .all ()
412
+ include_resource_uri = True
413
+ filtering = {
414
+ 'id' : ALL ,
415
+ 'name' : ALL ,
416
+ 'description' : ALL ,
417
+ }
418
+ authentication = DojoApiKeyAuthentication ()
419
+ authorization = DjangoAuthorization ()
420
+ serializer = Serializer (formats = ['json' ])
421
+
422
+ @property
423
+ def validation (self ):
424
+ return ModelFormValidation (form_class = ToolTypeForm , resource = Tool_TypeResource )
425
+
426
+
427
+ """
428
+ /api/v1/tool_configurations/
429
+ GET [/id/], DELETE [/id/]
430
+ Expects: no params or id
431
+ Returns Tool_ConfigurationResource
432
+ Relevant apply filter ?test_type=?, ?id=?
433
+
434
+ POST, PUT, DLETE [/id/]
435
+ """
436
+
437
+
438
+ class Tool_ConfigurationResource (BaseModelResource ):
439
+
440
+ tool_type = fields .ForeignKey (Tool_TypeResource , 'tool_type' , full = False , null = False )
441
+
442
+ class Meta :
443
+ resource_name = 'tool_configurations'
444
+ list_allowed_methods = ['get' , 'post' , 'put' , 'delete' ]
445
+ detail_allowed_methods = ['get' , 'post' , 'put' , 'delete' ]
446
+ queryset = Tool_Configuration .objects .all ()
447
+ include_resource_uri = True
448
+ filtering = {
449
+ 'id' : ALL ,
450
+ 'name' : ALL ,
451
+ 'tool_type' : ALL_WITH_RELATIONS ,
452
+ 'name' : ALL ,
453
+ 'tool_project_id' : ALL ,
454
+ 'url' : ALL ,
455
+ 'authentication_type' : ALL ,
456
+ }
457
+ authentication = DojoApiKeyAuthentication ()
458
+ authorization = DjangoAuthorization ()
459
+ serializer = Serializer (formats = ['json' ])
460
+
461
+ @property
462
+ def validation (self ):
463
+ return ModelFormValidation (form_class = ToolConfigForm , resource = Tool_ConfigurationResource )
464
+
465
+
394
466
"""
395
467
POST, PUT [/id/]
396
468
Expects *product *target_start, *target_end, *status[In Progress, On Hold,
@@ -403,12 +475,18 @@ class EngagementResource(BaseModelResource):
403
475
full = False , null = False )
404
476
lead = fields .ForeignKey (UserResource , 'lead' ,
405
477
full = False , null = True )
478
+ source_code_management_server = fields .ForeignKey (Tool_ConfigurationResource , 'source_code_management_server' ,
479
+ full = False , null = False )
480
+ build_server = fields .ForeignKey (Tool_ConfigurationResource , 'build_server' ,
481
+ full = False , null = False )
482
+ orchestration_engine = fields .ForeignKey (Tool_ConfigurationResource , 'orchestration_engine' ,
483
+ full = False , null = False )
406
484
407
485
class Meta :
408
486
resource_name = 'engagements'
409
- list_allowed_methods = ['get' , 'post' ]
487
+ list_allowed_methods = ['get' , 'post' , 'patch' ]
410
488
# disabled delete for /id/
411
- detail_allowed_methods = ['get' , 'post' , 'put' ]
489
+ detail_allowed_methods = ['get' , 'post' , 'put' , 'patch' ]
412
490
queryset = Engagement .objects .all ()
413
491
include_resource_uri = True
414
492
filtering = {
@@ -425,14 +503,15 @@ class Meta:
425
503
'pen_test' : ALL ,
426
504
'status' : ALL ,
427
505
'product' : ALL ,
506
+ 'tool_configuration' : ALL_WITH_RELATIONS ,
428
507
}
429
508
authentication = DojoApiKeyAuthentication ()
430
509
authorization = DjangoAuthorization ()
431
510
serializer = Serializer (formats = ['json' ])
432
511
433
512
@property
434
513
def validation (self ):
435
- return ModelFormValidation (form_class = EngForm2 , resource = EngagementResource )
514
+ return ModelFormValidation (form_class = EngForm , resource = EngagementResource )
436
515
437
516
def dehydrate (self , bundle ):
438
517
if bundle .obj .eng_type is not None :
@@ -564,78 +643,6 @@ def validation(self):
564
643
return ModelFormValidation (form_class = LanguagesTypeForm , resource = LanguagesResource )
565
644
566
645
567
- """
568
- /api/v1/tool_configurations/
569
- GET [/id/], DELETE [/id/]
570
- Expects: no params or id
571
- Returns Tool_ConfigurationResource
572
- Relevant apply filter ?test_type=?, ?id=?
573
-
574
- POST, PUT, DLETE [/id/]
575
- """
576
-
577
-
578
- class Tool_TypeResource (BaseModelResource ):
579
-
580
- class Meta :
581
- resource_name = 'tool_types'
582
- list_allowed_methods = ['get' , 'post' , 'put' , 'delete' ]
583
- detail_allowed_methods = ['get' , 'post' , 'put' , 'delete' ]
584
- queryset = Tool_Type .objects .all ()
585
- include_resource_uri = True
586
- filtering = {
587
- 'id' : ALL ,
588
- 'name' : ALL ,
589
- 'description' : ALL ,
590
- }
591
- authentication = DojoApiKeyAuthentication ()
592
- authorization = DjangoAuthorization ()
593
- serializer = Serializer (formats = ['json' ])
594
-
595
- @property
596
- def validation (self ):
597
- return ModelFormValidation (form_class = ToolTypeForm , resource = Tool_TypeResource )
598
-
599
-
600
- """
601
- /api/v1/tool_configurations/
602
- GET [/id/], DELETE [/id/]
603
- Expects: no params or id
604
- Returns Tool_ConfigurationResource
605
- Relevant apply filter ?test_type=?, ?id=?
606
-
607
- POST, PUT, DLETE [/id/]
608
- """
609
-
610
-
611
- class Tool_ConfigurationResource (BaseModelResource ):
612
-
613
- tool_type = fields .ForeignKey (Tool_TypeResource , 'tool_type' , full = False , null = False )
614
-
615
- class Meta :
616
- resource_name = 'tool_configurations'
617
- list_allowed_methods = ['get' , 'post' , 'put' , 'delete' ]
618
- detail_allowed_methods = ['get' , 'post' , 'put' , 'delete' ]
619
- queryset = Tool_Configuration .objects .all ()
620
- include_resource_uri = True
621
- filtering = {
622
- 'id' : ALL ,
623
- 'name' : ALL ,
624
- 'tool_type' : ALL_WITH_RELATIONS ,
625
- 'name' : ALL ,
626
- 'tool_project_id' : ALL ,
627
- 'url' : ALL ,
628
- 'authentication_type' : ALL ,
629
- }
630
- authentication = DojoApiKeyAuthentication ()
631
- authorization = DjangoAuthorization ()
632
- serializer = Serializer (formats = ['json' ])
633
-
634
- @property
635
- def validation (self ):
636
- return ModelFormValidation (form_class = ToolConfigForm , resource = Tool_ConfigurationResource )
637
-
638
-
639
646
"""
640
647
/api/v1/tool_product_settings/
641
648
GET [/id/], DELETE [/id/]
0 commit comments