summaryrefslogtreecommitdiffstats
path: root/lib/private/Share/Share.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-11-02 23:26:49 +0100
committerLukas Reschke <lukas@statuscode.ch>2016-11-02 23:26:49 +0100
commit6920e609c02814d03a5dc83792de12d05f1da854 (patch)
tree03b2e78c3f5ccd670cd22cd5f4c6390dc867fe73 /lib/private/Share/Share.php
parent68cebef64ca38ea93bc1006d667726f42d7f9805 (diff)
downloadnextcloud-server-6920e609c02814d03a5dc83792de12d05f1da854.tar.gz
nextcloud-server-6920e609c02814d03a5dc83792de12d05f1da854.zip
Adjust tests and DI for Share.php
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'lib/private/Share/Share.php')
-rw-r--r--lib/private/Share/Share.php24
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php
index b9accda728c..f6da19f3bb8 100644
--- a/lib/private/Share/Share.php
+++ b/lib/private/Share/Share.php
@@ -45,6 +45,8 @@ namespace OC\Share;
use OC\Files\Filesystem;
use OCA\FederatedFileSharing\DiscoveryManager;
use OCP\DB\QueryBuilder\IQueryBuilder;
+use OCP\ILogger;
+use OCP\IUserManager;
use OCP\IUserSession;
use OCP\IDBConnection;
use OCP\IConfig;
@@ -128,19 +130,35 @@ class Share extends Constants {
* Find which users can access a shared item
* @param string $path to the file
* @param string $ownerUser owner of the file
+ * @param IUserManager $userManager
+ * @param ILogger $logger
* @param boolean $includeOwner include owner to the list of users with access to the file
* @param boolean $returnUserPaths Return an array with the user => path map
* @param boolean $recursive take all parent folders into account (default true)
* @return array
* @note $path needs to be relative to user data dir, e.g. 'file.txt'
* not '/admin/data/file.txt'
+ * @throws \OC\User\NoUserException
*/
- public static function getUsersSharingFile($path, $ownerUser, $includeOwner = false, $returnUserPaths = false, $recursive = true) {
- $userManager = \OC::$server->getUserManager();
+ public static function getUsersSharingFile($path,
+ $ownerUser,
+ IUserManager $userManager,
+ ILogger $logger,
+ $includeOwner = false,
+ $returnUserPaths = false,
+ $recursive = true) {
$userObject = $userManager->get($ownerUser);
if (is_null($userObject)) {
- \OCP\Util::writeLog('files', ' Backends provided no user object for ' . $ownerUser, \OCP\Util::ERROR);
+ $logger->error(
+ sprintf(
+ 'Backends provided no user object for %s',
+ $ownerUser
+ ),
+ [
+ 'app' => 'files',
+ ]
+ );
throw new \OC\User\NoUserException('Backends provided no user object');
}