diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2015-05-04 15:07:37 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2015-05-04 15:07:37 +0200 |
commit | 59c657da5354d646cd69b58f9860b991f5b627b6 (patch) | |
tree | 141e83661e8bbc00f057a3886ef3d75361afa707 /core/js | |
parent | 17fedc80dac7acd3d85f1f132455e94d4fd920c6 (diff) | |
parent | f524ae261ae53b7d3ea88f952ad29d72eb48dcb4 (diff) | |
download | nextcloud-server-59c657da5354d646cd69b58f9860b991f5b627b6.tar.gz nextcloud-server-59c657da5354d646cd69b58f9860b991f5b627b6.zip |
Merge pull request #15772 from owncloud/issue-15771-dont-restrict-permissions-for-share-owner
Do not restrict permissions for the original owner
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/share.js | 2 | ||||
-rw-r--r-- | core/js/tests/specs/shareSpec.js | 25 |
2 files changed, 26 insertions, 1 deletions
diff --git a/core/js/share.js b/core/js/share.js index 45873ca870e..6723b829ca5 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -356,7 +356,7 @@ OC.Share={ var data = OC.Share.loadItem(itemType, itemSource); var dropDownEl; var html = '<div id="dropdown" class="drop shareDropDown" data-item-type="'+itemType+'" data-item-source="'+itemSource+'">'; - if (data !== false && data.reshare !== false && data.reshare.uid_owner !== undefined) { + if (data !== false && data.reshare !== false && data.reshare.uid_owner !== undefined && data.reshare.uid_owner !== OC.currentUser) { html += '<span class="reshare">'; if (oc_config.enable_avatars === true) { html += '<div class="avatar"></div> '; diff --git a/core/js/tests/specs/shareSpec.js b/core/js/tests/specs/shareSpec.js index a16358b55c5..3e9a0b247d7 100644 --- a/core/js/tests/specs/shareSpec.js +++ b/core/js/tests/specs/shareSpec.js @@ -29,6 +29,7 @@ describe('OC.Share tests', function() { var oldEnableAvatars; var avatarStub; var placeholderStub; + var oldCurrentUser; beforeEach(function() { $('#testArea').append($('<div id="shareContainer"></div>')); @@ -62,8 +63,12 @@ describe('OC.Share tests', function() { oc_config.enable_avatars = false; avatarStub = sinon.stub($.fn, 'avatar'); placeholderStub = sinon.stub($.fn, 'imageplaceholder'); + + oldCurrentUser = OC.currentUser; + OC.currentUser = 'user0'; }); afterEach(function() { + OC.currentUser = oldCurrentUser; /* jshint camelcase:false */ oc_appconfig.core = oldAppConfig; loadItemStub.restore(); @@ -864,6 +869,26 @@ describe('OC.Share tests', function() { ); expect($('#dropdown #shareWithList').length).toEqual(0); }); + it('allows owner to share their own share when they are also the recipient', function() { + OC.currentUser = 'user1'; + loadItemStub.returns({ + reshare: { + permissions: OC.PERMISSION_READ, + uid_owner: 'user1' + }, + shares: [] + }); + OC.Share.showDropDown( + 'file', + 123, + $container, + true, + OC.PERMISSION_ALL, + 'shared_file_name.txt' + ); + // sharing still allowed + expect($('#dropdown #shareWithList').length).toEqual(1); + }); }); }); }); |