Skip to content

Commit

Permalink
Customize documentation URL (DefectDojo#5861)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiblik authored Feb 1, 2022
1 parent 2917130 commit 2e4f3c9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions dojo/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django.conf import settings


def globalize_oauth_vars(request):
def globalize_vars(request):
# return the value you want as a dictionnary. you may add multiple values in there.
return {'SHOW_LOGIN_FORM': settings.SHOW_LOGIN_FORM,
'FORGOT_PASSWORD': settings.FORGOT_PASSWORD,
Expand All @@ -16,7 +16,8 @@ def globalize_oauth_vars(request):
'SOCIAL_AUTH_KEYCLOAK_LOGIN_BUTTON_TEXT': settings.SOCIAL_AUTH_KEYCLOAK_LOGIN_BUTTON_TEXT,
'SAML2_ENABLED': settings.SAML2_ENABLED,
'SAML2_LOGIN_BUTTON_TEXT': settings.SAML2_LOGIN_BUTTON_TEXT,
'SAML2_LOGOUT_URL': settings.SAML2_LOGOUT_URL}
'SAML2_LOGOUT_URL': settings.SAML2_LOGOUT_URL,
'DOCUMENTATION_URL': settings.DOCUMENTATION_URL}


def bind_system_settings(request):
Expand Down
6 changes: 5 additions & 1 deletion dojo/settings/settings.dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@
'Lastname': 'last_name'
}),
DD_SAML2_ALLOW_UNKNOWN_ATTRIBUTE=(bool, False),
# if somebody is using own documentation how to use DefectDojo in his own company
DD_DOCUMENTATION_URL=(str, 'https://defectdojo.github.io/django-DefectDojo'),
# merging findings doesn't always work well with dedupe and reimport etc.
# disable it if you see any issues (and report them on github)
DD_DISABLE_FINDING_MERGE=(bool, False),
Expand Down Expand Up @@ -491,6 +493,8 @@ def generate_url(scheme, double_slashes, user, password, host, port, path, param
SOCIAL_AUTH_KEYCLOAK_ACCESS_TOKEN_URL = env('DD_SOCIAL_AUTH_KEYCLOAK_ACCESS_TOKEN_URL')
SOCIAL_AUTH_KEYCLOAK_LOGIN_BUTTON_TEXT = env('DD_SOCIAL_AUTH_KEYCLOAK_LOGIN_BUTTON_TEXT')

DOCUMENTATION_URL = env('DD_DOCUMENTATION_URL')

# Setting SLA_NOTIFY_ACTIVE and SLA_NOTIFY_ACTIVE_VERIFIED to False will disable the feature
# If you import thousands of Active findings through your pipeline everyday,
# and make the choice of enabling SLA notifications for non-verified findings,
Expand Down Expand Up @@ -682,7 +686,7 @@ def generate_url(scheme, double_slashes, user, password, host, port, path, param
'django.contrib.messages.context_processors.messages',
'social_django.context_processors.backends',
'social_django.context_processors.login_redirect',
'dojo.context_processors.globalize_oauth_vars',
'dojo.context_processors.globalize_vars',
'dojo.context_processors.bind_system_settings',
'dojo.context_processors.bind_alert_count',
],
Expand Down
2 changes: 1 addition & 1 deletion dojo/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
<li>
<a href="{% url 'swagger-ui_oa3' %}?docExpansion=none" target="_blank"><i class="fa fa-book fa-fw" title="OpenAPI v3 Docs"></i> API v2 OpenAPI3 Docs </a>
</li>
<li><a href="https://defectdojo.github.io/django-DefectDojo" target="_blank">
<li><a href="{{ DOCUMENTATION_URL }}" target="_blank">
<i class="fa fa-question-circle fa-fw"></i> Documentation</a>
</li>
{% endblock %}
Expand Down

0 comments on commit 2e4f3c9

Please sign in to comment.