Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions dojo/api_v2/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1692,6 +1692,9 @@ class FindingSerializer(serializers.ModelSerializer):
many=True, read_only=True, source="risk_acceptance_set",
)
push_to_jira = serializers.BooleanField(default=False)
found_by = serializers.PrimaryKeyRelatedField(
queryset=Test_Type.objects.all(), many=True,
)
age = serializers.IntegerField(read_only=True)
sla_days_remaining = serializers.IntegerField(read_only=True, allow_null=True)
finding_meta = FindingMetaSerializer(read_only=True, many=True)
Expand Down Expand Up @@ -1774,6 +1777,16 @@ def update(self, instance, validated_data):
if parsed_vulnerability_ids:
save_vulnerability_ids(instance, parsed_vulnerability_ids)

# Get found_by from validated_data
found_by = validated_data.pop("found_by", None)
# Handle updates to found_by data
if found_by:
instance.found_by.set(found_by)
# If there is no argument entered for found_by, the user would like to clear out the values on the Finding's found_by field
# Findings still maintain original found_by value associated with their test
# In the event the user does not supply the found_by field at all, we do not modify it
elif isinstance(found_by, list) and len(found_by) == 0:
instance.found_by.clear()
instance = super().update(
instance, validated_data,
)
Expand Down