|
|
@@ -649,6 +649,33 @@ def share_document(request):
|
|
|
})
|
|
|
|
|
|
|
|
|
+@api_error_handler
|
|
|
+@require_POST
|
|
|
+def share_document_link(request):
|
|
|
+ """
|
|
|
+ Globally activate of de-activate access to the document to logged-in users.
|
|
|
+
|
|
|
+ Example of input: {'name': 'link_read', 'is_link_on': true}
|
|
|
+ """
|
|
|
+ perm = request.POST.get('data')
|
|
|
+ uuid = request.POST.get('uuid')
|
|
|
+
|
|
|
+ if not uuid or not perm:
|
|
|
+ raise PopupException(_('share_document_link requires uuid and permission data'))
|
|
|
+ else:
|
|
|
+ perm = json.loads(perm)
|
|
|
+ uuid = json.loads(uuid)
|
|
|
+
|
|
|
+ doc = Document2.objects.get_by_uuid(user=request.user, uuid=uuid)
|
|
|
+
|
|
|
+ doc = doc.share(request.user, name=perm['name'], is_link_on=perm['is_link_on'])
|
|
|
+
|
|
|
+ return JsonResponse({
|
|
|
+ 'status': 0,
|
|
|
+ 'document': doc.to_dict()
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
@ensure_csrf_cookie
|
|
|
def export_documents(request):
|
|
|
if request.GET.get('documents'):
|