|
|
@@ -25,31 +25,38 @@ from django.http import Http404
|
|
|
from django.utils.functional import wraps
|
|
|
from django.utils.translation import ugettext as _
|
|
|
|
|
|
+from dashboard.models import extract_solr_exception_message
|
|
|
from desktop.lib.django_util import JsonResponse
|
|
|
from desktop.lib.exceptions_renderable import PopupException
|
|
|
from desktop.lib.i18n import smart_unicode
|
|
|
from desktop.lib.rest.http_client import RestException
|
|
|
from desktop.models import Document2, Document, FilesystemException
|
|
|
-from dashboard.models import extract_solr_exception_message
|
|
|
|
|
|
from notebook.conf import check_permissions
|
|
|
from notebook.connectors.base import QueryExpired, QueryError, SessionExpired, AuthenticationRequired, OperationTimeout,\
|
|
|
OperationNotSupported
|
|
|
+from notebook.models import _get_editor_type
|
|
|
|
|
|
|
|
|
LOG = logging.getLogger(__name__)
|
|
|
|
|
|
+
|
|
|
def check_editor_access_permission():
|
|
|
def inner(view_func):
|
|
|
def decorate(request, *args, **kwargs):
|
|
|
- editor_id = request.GET.get('type', 'hive')
|
|
|
+ editor_id = request.GET.get('editor')
|
|
|
+ editor_type = request.GET.get('type', 'hive')
|
|
|
|
|
|
- if check_permissions(request.user, editor_id):
|
|
|
- raise PopupException(_('Missing permission to access the %s Editor' % editor_id), error_code=401)
|
|
|
+ if editor_id: # Open existing saved editor document
|
|
|
+ editor_type = _get_editor_type(editor_id)
|
|
|
+
|
|
|
+ if check_permissions(request.user, editor_type):
|
|
|
+ raise PopupException(_('Missing permission to access the %s Editor' % editor_type), error_code=401)
|
|
|
return view_func(request, *args, **kwargs)
|
|
|
return wraps(view_func)(decorate)
|
|
|
return inner
|
|
|
|
|
|
+
|
|
|
def check_document_access_permission():
|
|
|
def inner(view_func):
|
|
|
def decorate(request, *args, **kwargs):
|