|
20 | 20 | from dojo.forms import NoteForm, TestForm, FindingForm, \ |
21 | 21 | DeleteTestForm, AddFindingForm, \ |
22 | 22 | ImportScanForm, ReImportScanForm, FindingBulkUpdateForm, JIRAFindingForm |
23 | | -from dojo.models import Product, Finding, Test, Notes, BurpRawRequestResponse, Endpoint, Stub_Finding, Finding_Template, JIRA_PKey, Cred_Mapping, Dojo_User |
| 23 | +from dojo.models import Product, Finding, Test, Notes, BurpRawRequestResponse, Endpoint, Stub_Finding, Finding_Template, JIRA_PKey, Cred_Mapping, Dojo_User, JIRA_Issue |
24 | 24 | from dojo.tools.factory import import_parser_factory |
25 | | -from dojo.utils import get_page_items, add_breadcrumb, get_cal_event, message, process_notifications, get_system_setting, create_notification, Product_Tab, calculate_grade |
26 | | -from dojo.tasks import add_issue_task |
| 25 | +from dojo.utils import get_page_items, add_breadcrumb, get_cal_event, message, process_notifications, get_system_setting, create_notification, Product_Tab, calculate_grade, log_jira_alert |
| 26 | +from dojo.tasks import add_issue_task, update_issue_task |
27 | 27 |
|
28 | 28 | logger = logging.getLogger(__name__) |
29 | 29 |
|
@@ -443,6 +443,17 @@ def finding_bulk_update(request, tid): |
443 | 443 | if form.cleaned_data['severity'] or form.cleaned_data['status']: |
444 | 444 | calculate_grade(test.engagement.product) |
445 | 445 |
|
| 446 | + for finding in finds: |
| 447 | + if JIRA_PKey.objects.filter(product=finding.test.engagement.product).count() == 0: |
| 448 | + log_jira_alert('Finding cannot be pushed to jira as there is no jira configuration for this product.', finding) |
| 449 | + else: |
| 450 | + old_status = finding.status() |
| 451 | + if form.cleaned_data['push_to_jira']: |
| 452 | + if JIRA_Issue.objects.filter(finding=finding).exists(): |
| 453 | + update_issue_task.delay(finding, old_status, True) |
| 454 | + else: |
| 455 | + add_issue_task.delay(finding, True) |
| 456 | + |
446 | 457 | messages.add_message(request, |
447 | 458 | messages.SUCCESS, |
448 | 459 | 'Bulk edit of findings was successful. Check to make sure it is what you intended.', |
|
0 commit comments