Only show smart link resolution errors to the user with the smart link edit permission.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-09-21 02:01:58 -04:00
parent f600ca5a1a
commit ff5a0d32d4
2 changed files with 10 additions and 1 deletions

View File

@@ -11,6 +11,7 @@
* Add support for natural keys to the DocumentPageImageCache model.
* Add database conversion test to the common app.
* Fix label display for resolved smart links when not using a dynamic label.
* Only show smart link resolution errors to the user with the smart link edit permission.
3.1.1 (2018-09-18)
==================

View File

@@ -3,6 +3,7 @@ from __future__ import absolute_import, unicode_literals
import logging
from django.contrib import messages
from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404
from django.template import RequestContext
from django.urls import reverse, reverse_lazy
@@ -58,7 +59,14 @@ class ResolvedSmartLinkView(DocumentListView):
except Exception as exception:
queryset = Document.objects.none()
if self.request.user.is_staff or self.request.user.is_superuser:
try:
AccessControlList.objects.check_access(
permissions=permission_smart_link_edit, user=request.user,
obj=self.smart_link
)
except PermissionDenied:
pass
else:
messages.error(
self.request, _('Smart link query error: %s' % exception)
)