summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2014-11-20 13:32:07 +0100
committerMorris Jobke <hey@morrisjobke.de>2014-11-20 13:32:07 +0100
commit288acb55a0384b0608b9df0e64dcf62b1fdc7387 (patch)
tree057e6281ebacb520f37d7680915e0e3f21a77b6e
parent6a08fca3636f229c6d617da9ea8cad653e533e88 (diff)
parent63fa8ec69abd9d0ae4435728023257f2685acb5d (diff)
downloadnextcloud-server-288acb55a0384b0608b9df0e64dcf62b1fdc7387.tar.gz
nextcloud-server-288acb55a0384b0608b9df0e64dcf62b1fdc7387.zip
Merge pull request #12305 from owncloud/sharelist-nodelete
Remove delete button in shared with others list
-rw-r--r--apps/files_sharing/js/sharedfilelist.js12
-rw-r--r--apps/files_sharing/tests/js/sharedfilelistSpec.js30
2 files changed, 30 insertions, 12 deletions
diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js
index 5869d7f77f7..7a7c24993c0 100644
--- a/apps/files_sharing/js/sharedfilelist.js
+++ b/apps/files_sharing/js/sharedfilelist.js
@@ -103,7 +103,11 @@
},
getDirectoryPermissions: function() {
- return OC.PERMISSION_READ | OC.PERMISSION_DELETE;
+ var perms = OC.PERMISSION_READ;
+ if (this._sharedWithUser) {
+ perms |= OC.PERMISSION_DELETE;
+ }
+ return perms;
},
updateStorageStatistics: function() {
@@ -203,7 +207,11 @@
}
file.name = OC.basename(share.path);
file.path = OC.dirname(share.path);
- file.permissions = OC.PERMISSION_ALL;
+ if (this._sharedWithUser) {
+ file.permissions = OC.PERMISSION_ALL;
+ } else {
+ file.permissions = OC.PERMISSION_ALL - OC.PERMISSION_DELETE;
+ }
if (file.path) {
file.extraData = share.path;
}
diff --git a/apps/files_sharing/tests/js/sharedfilelistSpec.js b/apps/files_sharing/tests/js/sharedfilelistSpec.js
index 812f30d75db..dc6931af6e8 100644
--- a/apps/files_sharing/tests/js/sharedfilelistSpec.js
+++ b/apps/files_sharing/tests/js/sharedfilelistSpec.js
@@ -91,7 +91,7 @@ describe('OCA.Sharing.FileList tests', function() {
file_source: 49,
file_target: '/local path/local name.txt',
path: 'files/something shared.txt',
- permissions: 31,
+ permissions: OC.PERMISSION_ALL,
stime: 11111,
share_type: OC.Share.SHARE_TYPE_USER,
share_with: 'user1',
@@ -127,7 +127,8 @@ describe('OCA.Sharing.FileList tests', function() {
expect($tr.attr('data-file')).toEqual('local name.txt');
expect($tr.attr('data-path')).toEqual('/local path');
expect($tr.attr('data-size')).not.toBeDefined();
- expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
+ expect(parseInt($tr.attr('data-permissions'), 10))
+ .toEqual(OC.PERMISSION_ALL); // read and delete
expect($tr.attr('data-mime')).toEqual('text/plain');
expect($tr.attr('data-mtime')).toEqual('11111000');
expect($tr.attr('data-share-owner')).toEqual('User Two');
@@ -169,7 +170,8 @@ describe('OCA.Sharing.FileList tests', function() {
expect($tr.attr('data-file')).toEqual('local name');
expect($tr.attr('data-path')).toEqual('/local path');
expect($tr.attr('data-size')).not.toBeDefined();
- expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
+ expect(parseInt($tr.attr('data-permissions'), 10))
+ .toEqual(OC.PERMISSION_ALL); // read and delete
expect($tr.attr('data-mime')).toEqual('httpd/unix-directory');
expect($tr.attr('data-mtime')).toEqual('11111000');
expect($tr.attr('data-share-owner')).toEqual('User Two');
@@ -244,7 +246,8 @@ describe('OCA.Sharing.FileList tests', function() {
expect($tr.attr('data-file')).toEqual('local name.txt');
expect($tr.attr('data-path')).toEqual('/local path');
expect($tr.attr('data-size')).not.toBeDefined();
- expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
+ expect(parseInt($tr.attr('data-permissions'), 10))
+ .toEqual(OC.PERMISSION_ALL - OC.PERMISSION_DELETE); // read
expect($tr.attr('data-mime')).toEqual('text/plain');
expect($tr.attr('data-mtime')).toEqual('11111000');
expect($tr.attr('data-share-owner')).not.toBeDefined();
@@ -285,7 +288,8 @@ describe('OCA.Sharing.FileList tests', function() {
expect($tr.attr('data-file')).toEqual('local name');
expect($tr.attr('data-path')).toEqual('/local path');
expect($tr.attr('data-size')).not.toBeDefined();
- expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
+ expect(parseInt($tr.attr('data-permissions'), 10))
+ .toEqual(OC.PERMISSION_ALL - OC.PERMISSION_DELETE); // read
expect($tr.attr('data-mime')).toEqual('httpd/unix-directory');
expect($tr.attr('data-mtime')).toEqual('11111000');
expect($tr.attr('data-share-owner')).not.toBeDefined();
@@ -336,7 +340,8 @@ describe('OCA.Sharing.FileList tests', function() {
expect($tr.attr('data-file')).toEqual('local name.txt');
expect($tr.attr('data-path')).toEqual('/local path');
expect($tr.attr('data-size')).not.toBeDefined();
- expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
+ expect(parseInt($tr.attr('data-permissions'), 10))
+ .toEqual(OC.PERMISSION_ALL - OC.PERMISSION_DELETE); // read
expect($tr.attr('data-mime')).toEqual('text/plain');
expect($tr.attr('data-mtime')).toEqual('11111000');
expect($tr.attr('data-share-owner')).not.toBeDefined();
@@ -404,7 +409,8 @@ describe('OCA.Sharing.FileList tests', function() {
expect($tr.attr('data-file')).toEqual('local name.txt');
expect($tr.attr('data-path')).toEqual('/local path');
expect($tr.attr('data-size')).not.toBeDefined();
- expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
+ expect(parseInt($tr.attr('data-permissions'), 10))
+ .toEqual(OC.PERMISSION_ALL - OC.PERMISSION_DELETE); // read
expect($tr.attr('data-mime')).toEqual('text/plain');
// always use the most recent stime
expect($tr.attr('data-mtime')).toEqual('22222000');
@@ -430,6 +436,7 @@ describe('OCA.Sharing.FileList tests', function() {
fileList.reload();
+ /* jshint camelcase: false */
ocsResponse = {
ocs: {
meta: {
@@ -496,7 +503,8 @@ describe('OCA.Sharing.FileList tests', function() {
expect($tr.attr('data-file')).toEqual('local name.txt');
expect($tr.attr('data-path')).toEqual('/local path');
expect($tr.attr('data-size')).not.toBeDefined();
- expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
+ expect(parseInt($tr.attr('data-permissions'), 10))
+ .toEqual(OC.PERMISSION_ALL - OC.PERMISSION_DELETE); // read
expect($tr.attr('data-mime')).toEqual('text/plain');
expect($tr.attr('data-mtime')).toEqual('11111000');
expect($tr.attr('data-share-recipients')).not.toBeDefined();
@@ -537,7 +545,8 @@ describe('OCA.Sharing.FileList tests', function() {
expect($tr.attr('data-file')).toEqual('local name.txt');
expect($tr.attr('data-path')).toEqual('/local path');
expect($tr.attr('data-size')).not.toBeDefined();
- expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
+ expect(parseInt($tr.attr('data-permissions'), 10))
+ .toEqual(OC.PERMISSION_ALL - OC.PERMISSION_DELETE); // read
expect($tr.attr('data-mime')).toEqual('text/plain');
expect($tr.attr('data-mtime')).toEqual('11111000');
expect($tr.attr('data-share-recipients')).not.toBeDefined();
@@ -633,7 +642,8 @@ describe('OCA.Sharing.FileList tests', function() {
}]);
$tr = fileList.$el.find('tr:first');
- expect(parseInt($tr.attr('data-share-permissions'), 10)).toEqual(OC.PERMISSION_ALL - OC.PERMISSION_SHARE - OC.PERMISSION_DELETE);
+ expect(parseInt($tr.attr('data-share-permissions'), 10))
+ .toEqual(OC.PERMISSION_ALL - OC.PERMISSION_SHARE - OC.PERMISSION_DELETE);
});
});
});