diff options
author | Björn Schießle <schiessle@owncloud.com> | 2014-08-27 10:31:35 +0200 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2014-08-27 10:31:35 +0200 |
commit | c35d60f6d80dbb244b6223de3fdb894b0ef34d34 (patch) | |
tree | 2719e18a9db147b81a0e812add34d427b64bda86 /lib/private | |
parent | 2740908a5b168563b60ab9cf40ae274c2ce1df25 (diff) | |
parent | 0a77a5ec1938529f4a190df33a35b3a0c9633e4f (diff) | |
download | nextcloud-server-c35d60f6d80dbb244b6223de3fdb894b0ef34d34.tar.gz nextcloud-server-c35d60f6d80dbb244b6223de3fdb894b0ef34d34.zip |
Merge pull request #9915 from suraia/unsharefromself-source
Allow specifying the item source in unshareFromSelf().
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/share/share.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php index 4bf6622c561..faa6453d640 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -719,23 +719,24 @@ class Share extends \OC\Share\Constants { /** * Unshare an item shared with the current user * @param string $itemType - * @param string $itemTarget + * @param string $itemOrigin Item target or source + * @param boolean $originIsSource true if $itemOrigin is the source, false if $itemOrigin is the target (optional) * @return boolean true on success or false on failure * * Unsharing from self is not allowed for items inside collections */ - public static function unshareFromSelf($itemType, $itemTarget) { - + public static function unshareFromSelf($itemType, $itemOrigin, $originIsSource = false) { + $originType = ($originIsSource) ? 'source' : 'target'; $uid = \OCP\User::getUser(); if ($itemType === 'file' || $itemType === 'folder') { - $statement = 'SELECT * FROM `*PREFIX*share` WHERE `item_type` = ? and `file_target` = ?'; + $statement = 'SELECT * FROM `*PREFIX*share` WHERE `item_type` = ? and `file_' . $originType . '` = ?'; } else { - $statement = 'SELECT * FROM `*PREFIX*share` WHERE `item_type` = ? and `item_target` = ?'; + $statement = 'SELECT * FROM `*PREFIX*share` WHERE `item_type` = ? and `item_' . $originType . '` = ?'; } $query = \OCP\DB::prepare($statement); - $result = $query->execute(array($itemType, $itemTarget)); + $result = $query->execute(array($itemType, $itemOrigin)); $shares = $result->fetchAll(); |