diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-10 20:01:41 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-10 20:01:41 +0100 |
commit | 3184115c3cbd5535e4938d8e272f3de2250b67dd (patch) | |
tree | 877864aa757a8e0eddccbfeda96f2f573d9ad918 | |
parent | 63671a571e94c4602865aacfe03a8bb00bdd1da9 (diff) | |
parent | 9651defe3f6358b7a880fbf9a815b146009170a5 (diff) | |
download | nextcloud-server-3184115c3cbd5535e4938d8e272f3de2250b67dd.tar.gz nextcloud-server-3184115c3cbd5535e4938d8e272f3de2250b67dd.zip |
Merge pull request #22285 from owncloud/fix_22275
Only show link shares for the current user
-rw-r--r-- | core/js/shareitemmodel.js | 9 | ||||
-rw-r--r-- | core/js/tests/specs/shareitemmodelSpec.js | 8 | ||||
-rw-r--r-- | lib/private/share/share.php | 6 |
3 files changed, 19 insertions, 4 deletions
diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js index a7764dd6266..a28bcac91cb 100644 --- a/core/js/shareitemmodel.js +++ b/core/js/shareitemmodel.js @@ -46,6 +46,7 @@ * @property {string} mail_send * @property {Date} expiration optional? * @property {number} stime optional? + * @property {string} uid_owner */ /** @@ -725,6 +726,14 @@ || share.item_source === this.get('itemSource')); if (isShareLink) { + /* + * Ignore reshared link shares for now + * FIXME: Find a way to display properly + */ + if (share.uid_owner !== OC.currentUser) { + return share; + } + var link = window.location.protocol + '//' + window.location.host; if (!share.token) { // pre-token link diff --git a/core/js/tests/specs/shareitemmodelSpec.js b/core/js/tests/specs/shareitemmodelSpec.js index b2480a8beaa..8c9560d2646 100644 --- a/core/js/tests/specs/shareitemmodelSpec.js +++ b/core/js/tests/specs/shareitemmodelSpec.js @@ -164,6 +164,8 @@ describe('OC.Share.ShareItemModel', function() { } ])); + OC.currentUser = 'root'; + model.fetch(); var shares = model.get('shares'); @@ -253,7 +255,7 @@ describe('OC.Share.ShareItemModel', function() { uid_owner: 'root' }] )); - + OC.currentUser = 'root'; model.fetch(); var shares = model.get('shares'); @@ -443,7 +445,7 @@ describe('OC.Share.ShareItemModel', function() { token: 'tehtoken', uid_owner: 'root' }])); - + OC.currentUser = 'root'; model.fetch(); var res = model.sendEmailPrivateLink('foo@bar.com'); @@ -493,7 +495,7 @@ describe('OC.Share.ShareItemModel', function() { token: 'tehtoken', uid_owner: 'root' }])); - + OC.currentUser = 'root'; model.fetch(); var res = model.sendEmailPrivateLink('foo@bar.com'); diff --git a/lib/private/share/share.php b/lib/private/share/share.php index b09adf1aa99..149dd082bbc 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -2495,7 +2495,8 @@ class Share extends Constants { if ($fileDependent) { $select = '`*PREFIX*share`.`id`, `*PREFIX*share`.`parent`, `share_type`, `path`, `storage`, ' . '`share_with`, `uid_owner` , `file_source`, `stime`, `*PREFIX*share`.`permissions`, ' - . '`*PREFIX*storages`.`id` AS `storage_id`, `*PREFIX*filecache`.`parent` as `file_parent`'; + . '`*PREFIX*storages`.`id` AS `storage_id`, `*PREFIX*filecache`.`parent` as `file_parent`, ' + . '`uid_initiator`'; } else { $select = '`id`, `parent`, `share_type`, `share_with`, `uid_owner`, `item_source`, `stime`, `*PREFIX*share`.`permissions`'; } @@ -2583,6 +2584,9 @@ class Share extends Constants { $statuses = array(); foreach ($items as $item) { if ($item['share_type'] === self::SHARE_TYPE_LINK) { + if ($item['uid_initiator'] !== \OC::$server->getUserSession()->getUser()->getUID()) { + continue; + } $statuses[$item[$column]]['link'] = true; } else if (!isset($statuses[$item[$column]])) { $statuses[$item[$column]]['link'] = false; |