From f1bfe35cda2f11d1b38726cf2d4f879427b2c8d5 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 4 Sep 2014 19:58:49 +0200 Subject: Added permission check for drag and drop When dropping files onto a read-only folder, a notification is now shown instead of attempting to upload. This for both the drag for upload and drag from inside the file list cases. --- apps/files/js/files.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'apps/files/js/files.js') diff --git a/apps/files/js/files.js b/apps/files/js/files.js index df0c40a4405..5fcf99d24af 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -433,7 +433,12 @@ var folderDropOptions = { return false; } - var targetPath = FileList.getCurrentDirectory() + '/' + $(this).closest('tr').data('file'); + var $tr = $(this).closest('tr'); + if (($tr.data('permissions') & OC.PERMISSION_CREATE) === 0) { + FileList._showPermissionDeniedNotification(); + return false; + } + var targetPath = FileList.getCurrentDirectory() + '/' + $tr.data('file'); var files = FileList.getSelectedFiles(); if (files.length === 0) { -- cgit v1.2.3