Esempio n. 1
0
        def decorate(request, *args, **kwargs):
            editor_id = 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)
            return view_func(request, *args, **kwargs)
Esempio n. 2
0
    def decorate(request, *args, **kwargs):
      editor_id = request.GET.get('editor')
      editor_type = request.GET.get('type', 'hive')

      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)
Esempio n. 3
0
    def decorate(request, *args, **kwargs):
      editor_id = request.GET.get('editor')
      editor_type = request.GET.get('type', 'hive')
      gist_id = request.POST.get('gist')

      if editor_type == 'gist' or gist_id: # Gist don't have permissions currently
        pass
      else:
        if editor_id:  # Open existing saved editor document
          try:
            editor_type = _get_editor_type(editor_id)
          except Document2.DoesNotExist:
            raise PopupException(_('Query id %s can not be found, please open a new editor') % 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)