summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js/share.js
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-05-27 11:05:31 +0200
committerRobin Appelman <icewind@owncloud.com>2014-06-06 09:55:59 +0200
commitbf5e9357fc5dacc0bc951e7c60fe7105533a56fb (patch)
treeb61d8f542b92dd11e1cffdd59bee90272482890c /apps/files_sharing/js/share.js
parenta66c2e6a4757b5d97e120897df1085e4410b279a (diff)
downloadnextcloud-server-bf5e9357fc5dacc0bc951e7c60fe7105533a56fb.tar.gz
nextcloud-server-bf5e9357fc5dacc0bc951e7c60fe7105533a56fb.zip
don't allow to share single files with delete permissions, user should only be possible to unshare a single file but never to delete it
Diffstat (limited to 'apps/files_sharing/js/share.js')
-rw-r--r--apps/files_sharing/js/share.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index d63a590fb8e..47fe0bd2c57 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -18,12 +18,17 @@
var oldCreateRow = OCA.Files.FileList.prototype._createRow;
OCA.Files.FileList.prototype._createRow = function(fileData) {
var tr = oldCreateRow.apply(this, arguments);
+ var sharePermissions = fileData.permissions;
+ if (fileData.type === 'file') {
+ // files can't be shared with delete permissions
+ sharePermissions = sharePermissions & ~OC.PERMISSION_DELETE;
+ }
+ tr.attr('data-share-permissions', sharePermissions);
if (fileData.shareOwner) {
tr.attr('data-share-owner', fileData.shareOwner);
// user should always be able to rename a mount point
if (fileData.isShareMountPoint) {
tr.attr('data-permissions', fileData.permissions | OC.PERMISSION_UPDATE);
- tr.attr('data-reshare-permissions', fileData.permissions);
}
}
if (fileData.recipientsDisplayName) {
@@ -94,7 +99,7 @@
if ($tr.data('type') === 'dir') {
itemType = 'folder';
}
- var possiblePermissions = $tr.data('reshare-permissions');
+ var possiblePermissions = $tr.data('share-permissions');
if (_.isUndefined(possiblePermissions)) {
possiblePermissions = $tr.data('permissions');
}