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:
@@ -11,6 +11,7 @@
|
|||||||
* Add support for natural keys to the DocumentPageImageCache model.
|
* Add support for natural keys to the DocumentPageImageCache model.
|
||||||
* Add database conversion test to the common app.
|
* Add database conversion test to the common app.
|
||||||
* Fix label display for resolved smart links when not using a dynamic label.
|
* 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)
|
3.1.1 (2018-09-18)
|
||||||
==================
|
==================
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from __future__ import absolute_import, unicode_literals
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.urls import reverse, reverse_lazy
|
from django.urls import reverse, reverse_lazy
|
||||||
@@ -58,7 +59,14 @@ class ResolvedSmartLinkView(DocumentListView):
|
|||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
queryset = Document.objects.none()
|
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(
|
messages.error(
|
||||||
self.request, _('Smart link query error: %s' % exception)
|
self.request, _('Smart link query error: %s' % exception)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user