diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-06-05 00:37:41 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-06-06 09:56:02 +0200 |
commit | 3459f99dd6b737d73881504fd7103679fc1d7fe6 (patch) | |
tree | 3870acbdb1a69bbe229ce78b352b196b4ac1e49e | |
parent | eec1c4398aeee1cda8a26a3a325fd16148473d57 (diff) | |
download | nextcloud-server-3459f99dd6b737d73881504fd7103679fc1d7fe6.tar.gz nextcloud-server-3459f99dd6b737d73881504fd7103679fc1d7fe6.zip |
make sure that we only delete shares for the current user
-rw-r--r-- | lib/private/share/share.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php index 172e61c5dc8..f02eacfed74 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -718,6 +718,8 @@ class Share extends \OC\Share\Constants { */ public static function unshareFromSelf($itemType, $itemTarget) { + $uid = \OCP\User::getUser(); + if ($itemType === 'file' || $itemType === 'folder') { $statement = 'SELECT * FROM `*PREFIX*share` WHERE `item_type` = ? and `file_target` = ?'; } else { @@ -732,13 +734,16 @@ class Share extends \OC\Share\Constants { $itemUnshared = false; foreach ($shares as $share) { if ((int)$share['share_type'] === \OCP\Share::SHARE_TYPE_USER && - $share['share_with'] === \OCP\User::getUser()) { + $share['share_with'] === $uid) { Helper::delete($share['id']); $itemUnshared = true; break; } elseif ((int)$share['share_type'] === \OCP\Share::SHARE_TYPE_GROUP) { - $groupShare = $share; - } elseif ((int)$share['share_type'] === self::$shareTypeGroupUserUnique) { + if (\OC_Group::inGroup($uid, $share['share_with'])) { + $groupShare = $share; + } + } elseif ((int)$share['share_type'] === self::$shareTypeGroupUserUnique && + $share['share_with'] === $uid) { $uniqueGroupShare = $share; } } |