Add edit permission check for display set modal and update template

This commit is contained in:
Ross
2026-02-09 10:49:28 +00:00
parent 3b9942054d
commit 035da12e96
2 changed files with 10 additions and 2 deletions
@@ -1,6 +1,9 @@
<div class="case-displayset-modal">
<div class="mb-3">
<h5>{{ ds.name }}</h5>
{% if can_edit %}
<a href="{% url 'atlas:case_displaysets_edit' ds.pk %}" class="btn btn-sm btn-outline-secondary ms-2">Edit display set</a>
{% endif %}
{% if ds.description %}
<div class="text-muted">{{ ds.description }}</div>
{% endif %}
@@ -8,7 +11,7 @@
{# Viewer area for the modal - mounted by rad/static/dv3d bundle #}
<div class="mb-3">
<div id="modal_viewer_{{ ds.pk }}" class="dicom-viewer-root" style="height:420px;" data-auto-cache-stack="false" data-annotationjson="{{ ds.annotations|escapejs }}" data-viewerstate="{{ ds.viewerstate|escapejs }}"></div>
<div id="modal_viewer_{{ ds.pk }}" class="dicom-viewer-root" style="height:420px;" data-auto-cache-stack="false" data-annotationjson="{{ ds.annotations }}" data-viewerstate="{{ ds.viewerstate }}"></div>
</div>
{% if ds.viewerstate and ds.annotations %}
+6 -1
View File
@@ -545,7 +545,12 @@ def case_displaysets_detail(request, pk):
def case_displaysets_modal(request, pk):
"""Return HTML fragment for a CaseDisplaySet to be shown inside a modal."""
displayset = get_object_or_404(CaseDisplaySet, pk=pk)
return render(request, 'atlas/case_displayset_modal.html', {'ds': displayset})
can_edit = False
try:
can_edit = displayset.case.check_user_can_edit(request.user)
except Exception:
can_edit = False
return render(request, 'atlas/case_displayset_modal.html', {'ds': displayset, 'can_edit': can_edit})
def case_displaysets_delete(request, pk):
try: