diff --git a/indigo_app/templates/indigo_api/document/show.html b/indigo_app/templates/indigo_api/document/show.html index 7c0ede85a..bf75d726d 100644 --- a/indigo_app/templates/indigo_api/document/show.html +++ b/indigo_app/templates/indigo_api/document/show.html @@ -175,8 +175,8 @@
{% endverbatim %} - {% if provision_eid %} - + {% if provision_eid or perms.indigo_api.publish_document %} + {% endif %} {% endblock %} 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..ac675282e 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 @@ -69,7 +69,14 @@
{{ entry.date|date:"Y-m-d" }}
{% endfor %}
{% for document in entry.expressions %} -
{{ document.title }} · {{ document.language }}
+
+ {% block document %} + {{ document.title }} · {{ document.language }} + {% if perms.indigo_api.publish_document %} + {% trans "Provision editor" %} + {% endif %} + {% endblock %} +
{% endfor %} {% for task in entry.tasks %}
diff --git a/indigo_app/views/documents.py b/indigo_app/views/documents.py index 968da4b3f..a382a4d03 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() @@ -145,9 +144,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