mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-27 18:33:12 +01:00
Add HELPDESK_ENABLE_ATTACHMENTS setting and make it show/hide attachment related UI
Default setting is false. This is not backward compatible. The rationale is: attachments contain most likely sensitive information. By default they are served without access control. Currently there is no simple feature to configure access control. To avoid unintentional disclosure attachments should be an opt in: you have been warned.
This commit is contained in:
parent
c77bb30035
commit
dd4c04945a
@ -239,6 +239,7 @@ class AbstractTicketForm(CustomFieldMixin, forms.Form):
|
||||
label=_('Due on'),
|
||||
)
|
||||
|
||||
if helpdesk_settings.HELPDESK_ENABLE_ATTACHMENTS:
|
||||
attachment = forms.FileField(
|
||||
widget=forms.FileInput(attrs={'class': 'form-control-file'}),
|
||||
required=False,
|
||||
|
@ -56,6 +56,11 @@ HELPDESK_STAFF_VIEW_PROTECTOR = getattr(settings,
|
||||
'HELPDESK_STAFF_VIEW_PROTECTOR',
|
||||
lambda _: None)
|
||||
|
||||
# Enable ticket and Email attachments
|
||||
HELPDESK_ENABLE_ATTACHMENTS = getattr(settings,
|
||||
'HELPDESK_ENABLE_ATTACHMENTS',
|
||||
False)
|
||||
|
||||
# Enable the Dependencies field on ticket view
|
||||
HELPDESK_ENABLE_DEPENDENCIES_ON_TICKET = getattr(settings,
|
||||
'HELPDESK_ENABLE_DEPENDENCIES_ON_TICKET',
|
||||
|
@ -123,6 +123,7 @@
|
||||
|
||||
</dl>
|
||||
|
||||
{% if helpdesk_settings.HELPDESK_ENABLE_ATTACHMENTS %}
|
||||
<p id='ShowFileUploadPara'><button class="btn btn-warning btn-sm"
|
||||
id='ShowFileUpload' onclick="$('#FileUpload')[0].style.display='block';return false;" >{% trans "Attach File(s) »" %}</button></p>
|
||||
|
||||
@ -140,7 +141,7 @@
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
</fieldset>
|
||||
|
||||
<button class="btn btn-primary btn-lg" style="margin-bottom:10px" type='submit'>{% trans "Update This Ticket" %}</button>
|
||||
|
@ -54,6 +54,7 @@
|
||||
<li>{% blocktrans with change.field as field and change.old_value as old_value and change.new_value as new_value %}Changed {{ field }} from {{ old_value }} to {{ new_value }}.{% endblocktrans %}</li>
|
||||
{% if forloop.last %}</ul></div>{% endif %}
|
||||
{% endfor %}
|
||||
{% if helpdesk_settings.HELPDESK_ENABLE_ATTACHMENTS %}
|
||||
{% for attachment in followup.followupattachment_set.all %}{% if forloop.first %}{% trans "Attachments" %}:<div class='attachments'><ul>{% endif %}
|
||||
<li><a href='{{ attachment.file.url }}'>{{ attachment.filename }}</a> ({{ attachment.mime_type }}, {{ attachment.size|filesizeformat }})
|
||||
{% if followup.user and request.user == followup.user %}
|
||||
@ -62,6 +63,7 @@
|
||||
</li>
|
||||
{% if forloop.last %}</ul></div>{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</p>
|
||||
<!--- ugly long test to suppress the following if it will be empty, to save vertical space -->
|
||||
{% with possible=helpdesk_settings.HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP %}
|
||||
@ -197,7 +199,9 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if helpdesk_settings.HELPDESK_ENABLE_ATTACHMENTS %}
|
||||
<p id='ShowFileUploadPara'><button type="button" class="btn btn-warning btn-sm" id='ShowFileUpload'>{% trans "Attach File(s) »" %}</button></p>
|
||||
{% endif %}
|
||||
|
||||
<div id='FileUpload' style='display: none;'>
|
||||
|
||||
|
@ -150,6 +150,7 @@
|
||||
<td> <a href ="{{ticket.kbitem.query_url}}"> {{ticket.kbitem}} </a> </td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if helpdesk_settings.HELPDESK_ENABLE_ATTACHMENTS %}
|
||||
<tr>
|
||||
<th class="table-active">{% trans "Attachments" %}</th>
|
||||
<td colspan="3">
|
||||
@ -171,6 +172,7 @@
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr>
|
||||
<th class="table-active">{% trans "Checklists" %}</th>
|
||||
<td colspan="3">
|
||||
|
Loading…
Reference in New Issue
Block a user