From 559d5388f0cd502da3eae25ed30cc5e005e26f76 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 3 Jan 2019 16:58:16 +0100 Subject: Permissions: fix permission for context record, operation, sites associated to a find basket --- archaeological_context_records/models.py | 3 +++ .../templates/ishtar/sheet_contextrecord.html | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'archaeological_context_records') diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 2e9af17c1..d7d7a618d 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -538,6 +538,9 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem, def get_query_owns(cls, ishtaruser): q = cls._construct_query_own( 'operation__', Operation._get_query_owns_dicts(ishtaruser) + ) | cls._construct_query_own( + 'base_finds__find__basket__', + [{"shared_with": ishtaruser, "shared_write_with": ishtaruser}] ) | cls._construct_query_own('', [ {'history_creator': ishtaruser.user_ptr}, {'operation__end_date__isnull': True} diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html index 2ad74b7d2..af5da11dd 100644 --- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html @@ -171,9 +171,11 @@ {% endif %} {% trans "Document from this context record" as cr_docs %} +{% if permission_view_own_document or permission_view_document %} {% if item.documents.count %} {% dynamic_table_document cr_docs 'documents' 'context_records' item.pk '' output %} {% endif %} +{% endif %} {% trans "Finds" as finds %} {% if item.base_finds.count %} @@ -181,8 +183,10 @@ {% endif %} {% trans "Documents from associated finds" as finds_docs %} +{% if permission_view_own_document or permission_view_document %} {% if item.find_docs_q.count %} {% dynamic_table_document finds_docs 'documents' 'finds__base_finds__context_record' item.pk '' output %} {% endif %} +{% endif %} {% endblock %} -- cgit v1.2.3