update model,index

This commit is contained in:
otxtan@gmail.com
2024-05-29 15:50:06 +07:00
parent 8a4f809d83
commit 89e14fd49b
4 changed files with 32 additions and 18 deletions

View File

@@ -562,12 +562,18 @@ class DocumentViewSet(
def thumb(self, request, pk=None):
try:
doc = Document.objects.get(id=pk)
if request.user is not None and not has_perms_owner_aware(
request.user,
"view_document",
doc,
):
# Allow all users to view thumbnails
if request.user is None:
return HttpResponseForbidden("Insufficient permissions")
# Original
# if request.user is not None and not has_perms_owner_aware(
# request.user,
# "view_document",
# doc,
# ):
# return HttpResponseForbidden("Insufficient permissions")
if doc.storage_type == Document.STORAGE_TYPE_GPG:
handle = GnuPG.decrypted(doc.thumbnail_file)
else: