diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-11-10 13:08:45 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-11-21 16:17:37 +0100 |
commit | a7ebfe87c9ef16c698c16c4f72eaf3865825c540 (patch) | |
tree | f0101d948b458e067b479de0019eba55c5b82c25 /lib/private/share | |
parent | 13b06aa6dfeb7c63750461529b27494ed035707d (diff) | |
download | nextcloud-server-a7ebfe87c9ef16c698c16c4f72eaf3865825c540.tar.gz nextcloud-server-a7ebfe87c9ef16c698c16c4f72eaf3865825c540.zip |
also check for the correct owner if it was submitted
Diffstat (limited to 'lib/private/share')
-rw-r--r-- | lib/private/share/share.php | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php index a8febc9aca7..10fff9aeacf 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -287,12 +287,12 @@ class Share extends \OC\Share\Constants { * Get the item of item type shared with a given user by source * @param string $itemType * @param string $itemSource - * @param string $user User user to whom the item was shared + * @param string $user User to whom the item was shared + * @param string $owner Owner of the share * @param int $shareType only look for a specific share type * @return array Return list of items with file_target, permissions and expiration */ - public static function getItemSharedWithUser($itemType, $itemSource, $user, $shareType = null) { - + public static function getItemSharedWithUser($itemType, $itemSource, $user, $owner = null, $shareType = null) { $shares = array(); $fileDependend = false; @@ -320,6 +320,11 @@ class Share extends \OC\Share\Constants { $arguments[] = $shareType; } + if ($owner !== null) { + $where .= ' AND `uid_owner` = ? '; + $arguments[] = $owner; + } + $query = \OC_DB::prepare('SELECT ' . $select . ' FROM `*PREFIX*share` '. $where); $result = \OC_DB::executeAudited($query, $arguments); @@ -701,7 +706,7 @@ class Share extends \OC\Share\Constants { // check if it is a valid itemType self::getBackend($itemType); - $items = self::getItemSharedWithUser($itemType, $itemSource, $shareWith, $shareType); + $items = self::getItemSharedWithUser($itemType, $itemSource, $shareWith, null, $shareType); $toDelete = array(); $newParent = null; @@ -1629,7 +1634,7 @@ class Share extends \OC\Share\Constants { // Need to find a solution which works for all back-ends $collectionItems = array(); $collectionBackend = self::getBackend('folder'); - $sharedParents = $collectionBackend->getParents($item, $shareWith); + $sharedParents = $collectionBackend->getParents($item, $shareWith, $uidOwner); foreach ($sharedParents as $parent) { $collectionItems[] = $parent; } |