Skip to content

Commit

Permalink
Finding Group Filter Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
raouf-haddada committed Jun 4, 2024
1 parent d1db16e commit 9bfcbb8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 64 deletions.
16 changes: 7 additions & 9 deletions dojo/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
WAS_ACCEPTED_FINDINGS_QUERY,
)
from dojo.finding.queries import get_authorized_findings
from dojo.finding_group.queries import get_authorized_finding_groups
from dojo.models import (
EFFORT_FOR_FIXING_CHOICES,
ENGAGEMENT_STATUS_CHOICES,
Expand All @@ -70,7 +69,6 @@
Engagement,
Engagement_Survey,
Finding,
Finding_Group,
Finding_Template,
Note_Type,
Product,
Expand Down Expand Up @@ -1728,12 +1726,12 @@ class FindingFilterWithoutObjectLookups(FindingFilterHelper, FindingTagStringFil
finding_group__name = CharFilter(
field_name="finding_group__name",
lookup_expr="iexact",
label="Finding Group Name",
label="Finding Group",
help_text="Search for Finding Group names that are an exact match")
finding_group__name_contains = CharFilter(
field_name="finding_group__name",
lookup_expr="icontains",
label="Finding Group Name Contains",
label="Finding Group Contains",
help_text="Search for Finding Group names that contain a given pattern")

class Meta:
Expand Down Expand Up @@ -1790,9 +1788,11 @@ class FindingFilter(FindingFilterHelper, FindingTagFilter):
label="Test")

if is_finding_groups_enabled():
finding_group = ModelMultipleChoiceFilter(
queryset=Finding_Group.objects.none(),
label="Finding Group")
finding_group = CharFilter(
field_name="finding_group__name",
lookup_expr="icontains",
label="Finding Group",
help_text="Search for Finding Group contain a given pattern")

class Meta:
model = Finding
Expand Down Expand Up @@ -1837,8 +1837,6 @@ def set_related_object_fields(self, *args: list, **kwargs: dict):

if self.form.fields.get('test__engagement__product'):
self.form.fields['test__engagement__product'].queryset = get_authorized_products(Permissions.Product_View)
if self.form.fields.get('finding_group', None):
self.form.fields['finding_group'].queryset = get_authorized_finding_groups(Permissions.Finding_Group_View)
self.form.fields['reporter'].queryset = get_authorized_users(Permissions.Finding_View)
self.form.fields['reviewers'].queryset = self.form.fields['reporter'].queryset

Expand Down
55 changes: 0 additions & 55 deletions dojo/finding_group/queries.py

This file was deleted.

0 comments on commit 9bfcbb8

Please sign in to comment.