Commit 1add2f3f authored by Thomas Müller's avatar Thomas Müller
Browse files

Merge pull request #13679 from owncloud/public-disablesharejsplugin

Disable JS plugin for sharing in public mode
parents 29f49ddc efcd89cb
...@@ -64,7 +64,10 @@ $files = \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection); ...@@ -64,7 +64,10 @@ $files = \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection);
$formattedFiles = array(); $formattedFiles = array();
foreach ($files as $file) { foreach ($files as $file) {
$entry = \OCA\Files\Helper::formatFileInfo($file); $entry = \OCA\Files\Helper::formatFileInfo($file);
unset($entry['directory']); // for now // for now
unset($entry['directory']);
// do not disclose share owner
unset($entry['shareOwner']);
$entry['permissions'] = \OCP\Constants::PERMISSION_READ; $entry['permissions'] = \OCP\Constants::PERMISSION_READ;
$formattedFiles[] = $entry; $formattedFiles[] = $entry;
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* @param {OCA.Files.FileList} fileList file list to be extended * @param {OCA.Files.FileList} fileList file list to be extended
*/ */
attach: function(fileList) { attach: function(fileList) {
if (fileList.id === 'trashbin') { if (fileList.id === 'trashbin' || fileList.id === 'files.public') {
return; return;
} }
var fileActions = fileList.fileActions; var fileActions = fileList.fileActions;
......
...@@ -27,7 +27,7 @@ describe('OCA.Sharing.Util tests', function() { ...@@ -27,7 +27,7 @@ describe('OCA.Sharing.Util tests', function() {
$('#testArea').append($content); $('#testArea').append($content);
// dummy file list // dummy file list
var $div = $( var $div = $(
'<div>' + '<div id="listContainer">' +
'<table id="filestable">' + '<table id="filestable">' +
'<thead></thead>' + '<thead></thead>' +
'<tbody id="fileList"></tbody>' + '<tbody id="fileList"></tbody>' +
...@@ -450,5 +450,29 @@ describe('OCA.Sharing.Util tests', function() { ...@@ -450,5 +450,29 @@ describe('OCA.Sharing.Util tests', function() {
.toEqual('User four, User one, User three, User two, +6'); .toEqual('User four, User one, User three, User two, +6');
}); });
}); });
describe('Excluded lists', function() {
function createListThenAttach(listId) {
var fileActions = new OCA.Files.FileActions();
fileList.destroy();
fileList = new OCA.Files.FileList(
$('#listContainer'), {
id: listId,
fileActions: fileActions
}
);
OCA.Sharing.Util.attach(fileList);
fileList.setFiles(testFiles);
return fileList;
}
it('does not attach to trashbin or public file lists', function() {
createListThenAttach('trashbin');
expect($('.action-share').length).toEqual(0);
expect($('[data-share-recipient]').length).toEqual(0);
createListThenAttach('files.public');
expect($('.action-share').length).toEqual(0);
expect($('[data-share-recipient]').length).toEqual(0);
});
});
}); });
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment