diff --git a/core/js/share.js b/core/js/share.js
index 18e68ce78d..8ab92c2a85 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -68,7 +68,7 @@ OC.Share={
}
});
},
- showDropDown:function(itemType, item, appendTo, privateLink) {
+ showDropDown:function(itemType, item, appendTo, privateLink, possiblePermissions) {
var html = '
';
// TODO replace with autocomplete textbox
html += '
';
@@ -89,7 +89,7 @@ OC.Share={
if (share.share_type == OC.Share.SHARE_TYPE_PRIVATE_LINK) {
OC.Share.showPrivateLink(item, share.share_with);
} else {
- OC.Share.addShareWith(share.share_type, share.share_with, share.permissions);
+ OC.Share.addShareWith(share.share_type, share.share_with, share.permissions, possiblePermissions);
}
});
}
@@ -103,7 +103,7 @@ OC.Share={
}
});
},
- addShareWith:function(shareType, shareWith, permissions) {
+ addShareWith:function(shareType, shareWith, permissions, possiblePermissions) {
var editChecked = createChecked = updateChecked = deleteChecked = shareChecked = '';
if (permissions & OC.Share.PERMISSION_CREATE) {
createChecked = 'checked="checked"';
@@ -122,14 +122,24 @@ OC.Share={
}
var html = '
';
html += shareWith;
- html += '';
+ if (possiblePermissions & OC.Share.PERMISSION_CREATE || possiblePermissions & OC.Share.PERMISSION_UPDATE || possiblePermissions & OC.Share.PERMISSION_DELETE) {
+ html += '';
+ }
html += '';
html += '';
html += '';
- html += '';
- html += '';
- html += '';
- html += '';
+ if (possiblePermissions & OC.Share.PERMISSION_CREATE) {
+ html += '';
+ }
+ if (possiblePermissions & OC.Share.PERMISSION_UPDATE) {
+ html += '';
+ }
+ if (possiblePermissions & OC.Share.PERMISSION_DELETE) {
+ html += '';
+ }
+ if (possiblePermissions & OC.Share.PERMISSION_SHARE) {
+ html += '';
+ }
html += '
';
html += '';
$(html).appendTo('#shareWithList');
@@ -179,7 +189,7 @@ $(document).ready(function() {
if ($(this).data('private-link') !== undefined && $(this).data('private-link') == true) {
privateLink = true;
}
- OC.Share.showDropDown($(this).data('item-type'), $(this).data('item'), $(this).parent().parent(), privateLink);
+ OC.Share.showDropDown($(this).data('item-type'), $(this).data('item'), $(this).parent().parent(), privateLink, $(this).data('possible-permissions'));
}
});
@@ -214,8 +224,10 @@ $(document).ready(function() {
var item = $('#dir').val() + '/' + filename;
if ($('tr').filterAttr('data-file', filename).data('type') == 'dir') {
var itemType = 'folder';
+ var possiblePermissions = OC.Share.PERMISSION_CREATE | OC.Share.PERMISSION_UPDATE | OC.Share.PERMISSION_DELETE | OC.Share.PERMISSION_SHARE;
} else {
var itemType = 'file';
+ var possiblePermissions = OC.Share.PERMISSION_UPDATE | OC.Share.PERMISSION_DELETE | OC.Share.PERMISSION_SHARE;
}
var appendTo = $('tr').filterAttr('data-file', filename).find('td.filename');
// Check if drop down is already visible for a different file
@@ -224,12 +236,12 @@ $(document).ready(function() {
OC.Share.hideDropDown(function () {
$('tr').removeClass('mouseOver');
$('tr').filterAttr('data-file', filename).addClass('mouseOver');
- OC.Share.showDropDown(itemType, item, appendTo, true);
+ OC.Share.showDropDown(itemType, item, appendTo, true, possiblePermissions);
});
}
} else {
$('tr').filterAttr('data-file',filename).addClass('mouseOver');
- OC.Share.showDropDown(itemType, item, appendTo, true);
+ OC.Share.showDropDown(itemType, item, appendTo, true, possiblePermissions);
}
});
}