diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-09-05 12:20:48 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-09-05 12:20:48 +0200 |
commit | 5913a694de0e98e918d9d08340ac88c9f1eab937 (patch) | |
tree | 8b34600e2e271c3ab2fd44989977ab82dcaf8566 /apps/files/js/filelist.js | |
parent | 614cf996ca74d26263f3ffeb43e7a9b81eadfae6 (diff) | |
parent | f1bfe35cda2f11d1b38726cf2d4f879427b2c8d5 (diff) | |
download | nextcloud-server-5913a694de0e98e918d9d08340ac88c9f1eab937.tar.gz nextcloud-server-5913a694de0e98e918d9d08340ac88c9f1eab937.zip |
Merge pull request #10870 from owncloud/dnd-droponreadonlyfolderfix
Added permission check for drag and drop
Diffstat (limited to 'apps/files/js/filelist.js')
-rw-r--r-- | apps/files/js/filelist.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 037e04db21c..4a9c56e6bf5 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1632,6 +1632,18 @@ }, /** + * Shows a "permission denied" notification + */ + _showPermissionDeniedNotification: function() { + var message = t('core', 'You don’t have permission to upload or create files here'); + OC.Notification.show(message); + //hide notification after 10 sec + setTimeout(function() { + OC.Notification.hide(); + }, 5000); + }, + + /** * Setup file upload events related to the file-upload plugin */ setupUploadEvents: function() { @@ -1662,6 +1674,12 @@ // remember as context data.context = dropTarget; + // if permissions are specified, only allow if create permission is there + var permissions = dropTarget.data('permissions'); + if (!_.isUndefined(permissions) && (permissions & OC.PERMISSION_CREATE) === 0) { + self._showPermissionDeniedNotification(); + return false; + } var dir = dropTarget.data('file'); // if from file list, need to prepend parent dir if (dir) { @@ -1686,6 +1704,7 @@ // cancel uploads to current dir if no permission var isCreatable = (self.getDirectoryPermissions() & OC.PERMISSION_CREATE) !== 0; if (!isCreatable) { + self._showPermissionDeniedNotification(); return false; } } |