Skip to content

Commit

Permalink
Merge pull request #5384 from DefectDojo/release/2.4.1
Browse files Browse the repository at this point in the history
Release: Merge release into master from: release/2.4.1
  • Loading branch information
Maffooch committed Nov 3, 2021
2 parents 3d22a00 + 24d9293 commit f24952e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion components/package.json
@@ -1,6 +1,6 @@
{
"name": "defectdojo",
"version": "2.4.0",
"version": "2.4.1",
"private": true,
"dependencies": {
"JUMFlot": "jumjum123/JUMFlot#*",
Expand Down
2 changes: 1 addition & 1 deletion dojo/__init__.py
Expand Up @@ -6,6 +6,6 @@

default_app_config = 'dojo.apps.DojoAppConfig'

__version__ = '2.4.0'
__version__ = '2.4.1'
__url__ = 'https://github.com/DefectDojo/django-DefectDojo'
__docs__ = 'https://defectdojo.github.io/django-DefectDojo'
28 changes: 20 additions & 8 deletions dojo/db_migrations/0131_migrate_sonarcube_cobalt.py
Expand Up @@ -2,39 +2,51 @@

from django.db import migrations

from dojo.models import Sonarqube_Product, Cobaltio_Product, Product_API_Scan_Configuration, Test


def migrate_sonarqube(apps, schema_editor):
sq_products = Sonarqube_Product.objects.filter(sonarqube_tool_config__isnull=False)

Sonarqube_Product_model = apps.get_model('dojo', 'Sonarqube_Product')
Product_API_Scan_Configuration_model = apps.get_model('dojo', 'Product_API_Scan_Configuration')
Test_model = apps.get_model('dojo', 'Test')

sq_products = Sonarqube_Product_model.objects.filter(sonarqube_tool_config__isnull=False)
for sq_product in sq_products:
api_scan_configuration = Product_API_Scan_Configuration()
api_scan_configuration = Product_API_Scan_Configuration_model()
api_scan_configuration.product = sq_product.product
api_scan_configuration.tool_configuration = sq_product.sonarqube_tool_config
api_scan_configuration.service_key_1 = sq_product.sonarqube_project_key
api_scan_configuration.save()
tests = Test.objects.filter(sonarqube_config=sq_product)

tests = Test_model.objects.filter(sonarqube_config=sq_product)
for test in tests:
test.api_scan_configuration = api_scan_configuration
test.sonarqube_config = None
test.save()

sq_product.delete()


def migrate_cobalt_io(apps, schema_editor):
cobalt_products = Cobaltio_Product.objects.filter(cobaltio_tool_config__isnull=False)

Cobaltio_Product_model = apps.get_model('dojo', 'Cobaltio_Product')
Product_API_Scan_Configuration_model = apps.get_model('dojo', 'Product_API_Scan_Configuration')
Test_model = apps.get_model('dojo', 'Test')

cobalt_products = Cobaltio_Product_model.objects.filter(cobaltio_tool_config__isnull=False)
for cobalt_product in cobalt_products:
api_scan_configuration = Product_API_Scan_Configuration()
api_scan_configuration = Product_API_Scan_Configuration_model()
api_scan_configuration.product = cobalt_product.product
api_scan_configuration.tool_configuration = cobalt_product.cobaltio_tool_config
api_scan_configuration.service_key_1 = cobalt_product.cobaltio_asset_id
api_scan_configuration.service_key_2 = cobalt_product.cobaltio_asset_name
api_scan_configuration.save()
tests = Test.objects.filter(cobaltio_config=cobalt_product)

tests = Test_model.objects.filter(cobaltio_config=cobalt_product)
for test in tests:
test.api_scan_configuration = api_scan_configuration
test.cobaltio_config = None
test.save()

cobalt_product.delete()


Expand Down
4 changes: 2 additions & 2 deletions dojo/product/views.py
Expand Up @@ -1579,7 +1579,7 @@ def view_api_scan_configurations(request, pid):
})


@user_is_authorized(Product, Permissions.Product_API_Scan_Configuration_Edit, 'pascid', 'staff')
@user_is_authorized(Product_API_Scan_Configuration, Permissions.Product_API_Scan_Configuration_Edit, 'pascid', 'staff')
def edit_api_scan_configuration(request, pid, pascid):

product_api_scan_configuration = get_object_or_404(Product_API_Scan_Configuration, id=pascid)
Expand Down Expand Up @@ -1624,7 +1624,7 @@ def edit_api_scan_configuration(request, pid, pascid):
})


@user_is_authorized(Product, Permissions.Product_API_Scan_Configuration_Delete, 'pascid', 'staff')
@user_is_authorized(Product_API_Scan_Configuration, Permissions.Product_API_Scan_Configuration_Delete, 'pascid', 'staff')
def delete_api_scan_configuration(request, pid, pascid):

product_api_scan_configuration = get_object_or_404(Product_API_Scan_Configuration, id=pascid)
Expand Down
2 changes: 1 addition & 1 deletion helm/defectdojo/Chart.yaml
@@ -1,5 +1,5 @@
apiVersion: v1
appVersion: "2.4.0"
appVersion: "2.4.1"
description: A Helm chart for Kubernetes to install DefectDojo
name: defectdojo
version: 1.6.21
Expand Down

0 comments on commit f24952e

Please sign in to comment.