From 518d5aadf51318886481696e4308fcc39684b508 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 9 Mar 2015 16:15:29 +0100 Subject: [PATCH] Allow getting *all* share entries owned by a user --- apps/files_sharing/tests/permissions.php | 4 +++- lib/private/share/share.php | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/tests/permissions.php b/apps/files_sharing/tests/permissions.php index 92703f4a90..91f0347163 100644 --- a/apps/files_sharing/tests/permissions.php +++ b/apps/files_sharing/tests/permissions.php @@ -103,7 +103,9 @@ class Test_Files_Sharing_Permissions extends OCA\Files_sharing\Tests\TestCase { } protected function tearDown() { - $this->sharedCache->clear(); + if ($this->sharedCache) { + $this->sharedCache->clear(); + } self::loginHelper(self::TEST_FILES_SHARING_API_USER1); diff --git a/lib/private/share/share.php b/lib/private/share/share.php index 227a3d5a41..63bba06e67 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -2518,4 +2518,16 @@ class Share extends \OC\Share\Constants { $enforcePassword = $config->getAppValue('core', 'shareapi_enforce_links_password', 'no'); return ($enforcePassword === "yes") ? true : false; } + /** + * Get all share entries, including non-unique group items + * + * @param string $owner + * @return array + */ + public static function getAllSharesForOwner($owner) { + $query = 'SELECT * FROM `*PREFIX*share` WHERE `uid_owner` = ?'; + $result = \OC::$server->getDatabaseConnection()->executeQuery($query, [$owner]); + return $result->fetchAll(); + } + }