Skip to content

Commit

Permalink
fix existing
Browse files Browse the repository at this point in the history
  • Loading branch information
kiblik committed Oct 18, 2024
1 parent a70d81c commit a726115
Show file tree
Hide file tree
Showing 43 changed files with 91 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
('dojo', '0214_test_type_dynamically_generated'),
('dojo', '0215_webhooks_notifications'),
]

operations = [
Expand Down
2 changes: 1 addition & 1 deletion dojo/fixtures/defect_dojo_sample_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -7119,7 +7119,7 @@
"enable_finding_sla": true,
"allow_anonymous_survey_repsonse": false,
"credentials": "",
"disclaimer": "",
"disclaimer_notifications": "",
"risk_acceptance_form_default_days": 180,
"risk_acceptance_notify_before_expiration": 10,
"enable_credentials": true,
Expand Down
7 changes: 7 additions & 0 deletions dojo/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2288,6 +2288,13 @@ class ReportOptionsForm(forms.Form):
include_disclaimer = forms.ChoiceField(choices=yes_no, label="Disclaimer")
report_type = forms.ChoiceField(choices=(("HTML", "HTML"),))

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if get_system_setting("disclaimer_reports_forced"):
self.fields["include_disclaimer"].disabled = True
self.fields["include_disclaimer"].initial = "1" # represents yes
self.fields["include_disclaimer"].help_text="Administrator of the system enforced placement of disclaimer in all reports. You are not able exclude disclaimer from this report."


class CustomReportOptionsForm(forms.Form):
yes_no = (("0", "No"), ("1", "Yes"))
Expand Down
8 changes: 4 additions & 4 deletions dojo/reports/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ def product_endpoint_report(request, pid):
include_finding_images = int(request.GET.get("include_finding_images", 0))
include_executive_summary = int(request.GET.get("include_executive_summary", 0))
include_table_of_contents = int(request.GET.get("include_table_of_contents", 0))
include_disclaimer = int(request.GET.get("include_disclaimer", 0))
disclaimer = get_system_setting("disclaimer")
include_disclaimer = int(request.GET.get("include_disclaimer", 0)) or (get_system_setting("disclaimer_reports_forced", 0))
disclaimer = get_system_setting("disclaimer_reports")
if include_disclaimer and len(disclaimer) == 0:
disclaimer = "Please configure in System Settings."
generate = "_generate" in request.GET
Expand Down Expand Up @@ -355,8 +355,8 @@ def generate_report(request, obj, host_view=False):
include_finding_images = int(request.GET.get("include_finding_images", 0))
include_executive_summary = int(request.GET.get("include_executive_summary", 0))
include_table_of_contents = int(request.GET.get("include_table_of_contents", 0))
include_disclaimer = int(request.GET.get("include_disclaimer", 0))
disclaimer = get_system_setting("disclaimer")
include_disclaimer = int(request.GET.get("include_disclaimer", 0)) or (get_system_setting("disclaimer_reports_forced", 0))
disclaimer = get_system_setting("disclaimer_reports")

if include_disclaimer and len(disclaimer) == 0:
disclaimer = "Please configure in System Settings."
Expand Down
4 changes: 2 additions & 2 deletions dojo/templates/notifications/alert/review_requested.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

{% trans "Full details of the finding can be reviewed at" %} {{ url|full_url }}

{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
{% trans "Disclaimer:" %}
{{ system_settings.disclaimer }}
{{ system_settings.disclaimer_notifications }}
{% endif %}
4 changes: 2 additions & 2 deletions dojo/templates/notifications/mail/engagement_added.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
{% url 'notifications' as notification_url %}
{% trans "You can manage your notification settings here" %}: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>
</p>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">{% trans "Disclaimer" %}</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer_notifications }}</p>
</div>
{% endif %}
{% endautoescape %}
Expand Down
4 changes: 2 additions & 2 deletions dojo/templates/notifications/mail/other.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
{% url 'notifications' as notification_url %}
{% trans "You can manage your notification settings here" %}: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>
</p>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">{% trans "Disclaimer" %}</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer_notifications }}</p>
</div>
{% endif %}
{% endautoescape %}
Expand Down
4 changes: 2 additions & 2 deletions dojo/templates/notifications/mail/product_added.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
{% url 'notifications' as notification_url %}
{% trans "You can manage your notification settings here" %}: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>
</p>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">{% trans "Disclaimer" %}</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer_notifications }}</p>
</div>
{% endif %}
{% endautoescape %}
Expand Down
4 changes: 2 additions & 2 deletions dojo/templates/notifications/mail/product_type_added.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
{% url 'notifications' as notification_url %}
{% trans "You can manage your notification settings here" %}: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>
</p>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">{% trans "Disclaimer" %}</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer_notifications }}</p>
</div>
{% endif %}
{% endautoescape %}
Expand Down
4 changes: 2 additions & 2 deletions dojo/templates/notifications/mail/report_created.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
{% trans "You can manage your notification settings here" %}: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>

</p>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">{% trans "Disclaimer" %}</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer_notifications }}</p>
</div>
{% endif %}
{% endautoescape %}
Expand Down
4 changes: 2 additions & 2 deletions dojo/templates/notifications/mail/review_requested.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
{% url 'notifications' as notification_url %}
{% trans "You can manage your notification settings here" %}: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>
</p>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">{% trans "Disclaimer" %}</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer_notifications }}</p>
</div>
{% endif %}
{% endautoescape %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@
{% url 'notifications' as notification_url %}
{% trans "You can manage your notification settings here" %}: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>
</p>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">{% trans "Disclaimer" %}</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer_notifications }}</p>
</div>
{% endif %}
{% endautoescape %}
Expand Down
4 changes: 2 additions & 2 deletions dojo/templates/notifications/mail/scan_added.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@
{% url 'notifications' as notification_url %}
{% trans "You can manage your notification settings here" %}: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>
</p>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">{% trans "Disclaimer" %}</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer_notifications }}</p>
</div>
{% endif %}
{% endautoescape %}
Expand Down
4 changes: 2 additions & 2 deletions dojo/templates/notifications/mail/sla_breach.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
{% url 'notifications' as notification_url %}
{% trans "You can manage your notification settings here" %}: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>
</p>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">{% trans "Disclaimer" %}</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer_notifications }}</p>
</div>
{% endif %}
{% endautoescape %}
Expand Down
4 changes: 2 additions & 2 deletions dojo/templates/notifications/mail/sla_breach_combined.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
{% url 'notifications' as notification_url %}
{% trans "You can manage your notification settings here" %}: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>
</p>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
<br />
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt;
Expand All @@ -64,7 +64,7 @@
<br />
<p style="font-size:11pt;
line-height:10pt;
font-family: 'Cambria','times roman',serif">{{ system_settings.disclaimer }}</p>
font-family: 'Cambria','times roman',serif">{{ system_settings.disclaimer_notifications }}</p>
</div>
{% endif %}
{% endautoescape %}
Expand Down
4 changes: 2 additions & 2 deletions dojo/templates/notifications/mail/test_added.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
{% url 'notifications' as notification_url %}
{% trans "You can manage your notification settings here" %}: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>
</p>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">{% trans "Disclaimer" %}</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer_notifications }}</p>
</div>
{% endif %}
{% endautoescape %}
Expand Down
4 changes: 2 additions & 2 deletions dojo/templates/notifications/mail/upcoming_engagement.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
{% url 'notifications' as notification_url %}
{% trans "You can manage your notification settings here" %}: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>
</p>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">{% trans "Disclaimer" %}</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer_notifications }}</p>
</div>
{% endif %}
{% endautoescape %}
Expand Down
4 changes: 2 additions & 2 deletions dojo/templates/notifications/mail/user_mentioned.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
{% url 'notifications' as notification_url %}
{% trans "You can manage your notification settings here" %}: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>
</p>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">{% trans "Disclaimer" %}</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer_notifications }}</p>
</div>
{% endif %}
{% endautoescape %}
Expand Down
4 changes: 2 additions & 2 deletions dojo/templates/notifications/msteams/engagement_added.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
}
]
}
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
,{
"activityTitle": "{% trans "Disclaimer" %}",
"text": "{{ system_settings.disclaimer }}"
"text": "{{ system_settings.disclaimer_notifications }}"
}
{% endif %}

Expand Down
4 changes: 2 additions & 2 deletions dojo/templates/notifications/msteams/other.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"activityImage": "https://raw.githubusercontent.com/DefectDojo/django-DefectDojo/master/dojo/static/dojo/img/chop.png",
"text": "{% autoescape on %} {{ description }} {% endautoescape %}"
}
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
,{
"activityTitle": "{% trans "Disclaimer" %}",
"text": "{{ system_settings.disclaimer }}"
"text": "{{ system_settings.disclaimer_notifications }}"
}
{% endif %}
],
Expand Down
4 changes: 2 additions & 2 deletions dojo/templates/notifications/msteams/product_added.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
}
]
}
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
,{
"activityTitle": "{% trans "Disclaimer" %}",
"text": "{{ system_settings.disclaimer }}"
"text": "{{ system_settings.disclaimer_notifications }}"
}
{% endif %}
],
Expand Down
4 changes: 2 additions & 2 deletions dojo/templates/notifications/msteams/product_type_added.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
}
]
}
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
,{
"activityTitle": "{% trans "Disclaimer" %}",
"text": "{{ system_settings.disclaimer }}"
"text": "{{ system_settings.disclaimer_notifications }}"
}
{% endif %}
],
Expand Down
Loading

0 comments on commit a726115

Please sign in to comment.