From 24a1941812fbf8971896b79530b2802d18d2037d Mon Sep 17 00:00:00 2001
From: goose-life <32566441+goose-life@users.noreply.github.com>
Date: Thu, 23 Jan 2025 12:47:39 +0200
Subject: [PATCH] include links to provision editor on overview, restrict to
reviewers
---
.../indigo_api/timeline/_work_points_in_time.html | 9 +++++++++
indigo_app/views/documents.py | 8 ++------
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/indigo_app/templates/indigo_api/timeline/_work_points_in_time.html b/indigo_app/templates/indigo_api/timeline/_work_points_in_time.html
index d262f7f01..b9704cc7f 100644
--- a/indigo_app/templates/indigo_api/timeline/_work_points_in_time.html
+++ b/indigo_app/templates/indigo_api/timeline/_work_points_in_time.html
@@ -80,6 +80,15 @@
{{ entry.date|date:"Y-m-d" }}
{{ task.description|linebreaks|urlize }}
{% endfor %}
+ {% if perms.indigo_api.publish_document %}
+
+ {% for document in entry.expressions %}
+
+ {% endfor %}
+
+ {% endif %}
{% if editable and entry.create_import_document %}
diff --git a/indigo_app/views/documents.py b/indigo_app/views/documents.py
index e0c647a06..51339d742 100644
--- a/indigo_app/views/documents.py
+++ b/indigo_app/views/documents.py
@@ -98,6 +98,7 @@ class ChooseDocumentProvisionView(AbstractAuthedIndigoView, DetailView):
context_object_name = 'document'
pk_url_kwarg = 'doc_id'
template_name = 'indigo_api/document/_provisions.html'
+ permission_required = ('indigo_api.publish_document',)
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@@ -119,13 +120,11 @@ def descend_toc_dict(items):
elem['href'] = reverse('document_provision', kwargs={'doc_id': int(self.kwargs['doc_id']), 'eid': elem['id']})
return json.dumps(toc)
- def has_permission(self):
- return self.request.user.is_superuser
-
class DocumentProvisionDetailView(DocumentDetailView):
eid = None
provision_xml = None
+ permission_required = ('indigo_api.publish_document',)
def get(self, request, *args, **kwargs):
document = self.get_object()
@@ -144,9 +143,6 @@ def get_context_data(self, **kwargs):
def get_document_content_json(self, document):
return json.dumps(etree.tostring(self.provision_xml, encoding='unicode'))
- def has_permission(self):
- return self.request.user.is_superuser
-
class DocumentPopupView(AbstractAuthedIndigoView, DetailView):
model = Document