summaryrefslogtreecommitdiffstats
path: root/apps/federatedfilesharing/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-04-23 10:44:49 +0200
committerMorris Jobke <hey@morrisjobke.de>2018-04-23 13:49:28 +0200
commit093cd01ac27be9f081af04886f721ba2589ba445 (patch)
treece93ceb4f0b65102fc39a0e03342de98f43bd0e4 /apps/federatedfilesharing/lib
parent3ff041f86d936524674d2def257ddc4b15a2c105 (diff)
downloadnextcloud-server-093cd01ac27be9f081af04886f721ba2589ba445.tar.gz
nextcloud-server-093cd01ac27be9f081af04886f721ba2589ba445.zip
Fix DI for federated file sharing controller
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/federatedfilesharing/lib')
-rw-r--r--apps/federatedfilesharing/lib/AppInfo/Application.php3
-rw-r--r--apps/federatedfilesharing/lib/Controller/RequestHandlerController.php15
2 files changed, 12 insertions, 6 deletions
diff --git a/apps/federatedfilesharing/lib/AppInfo/Application.php b/apps/federatedfilesharing/lib/AppInfo/Application.php
index ba0126c3fa3..2c863de21c6 100644
--- a/apps/federatedfilesharing/lib/AppInfo/Application.php
+++ b/apps/federatedfilesharing/lib/AppInfo/Application.php
@@ -67,7 +67,8 @@ class Application extends App {
$notification,
$addressHandler,
$server->getUserManager(),
- $server->getCloudIdManager()
+ $server->getCloudIdManager(),
+ $server->getLogger()
);
});
}
diff --git a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php
index 4953b7c81a2..caf9e329abd 100644
--- a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php
+++ b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php
@@ -43,6 +43,7 @@ use OCP\Constants;
use OCP\Federation\ICloudIdManager;
use OCP\Files\NotFoundException;
use OCP\IDBConnection;
+use OCP\ILogger;
use OCP\IRequest;
use OCP\IUserManager;
use OCP\Share;
@@ -74,6 +75,9 @@ class RequestHandlerController extends OCSController {
/** @var ICloudIdManager */
private $cloudIdManager;
+ /** @var ILogger */
+ private $logger;
+
/**
* Server2Server constructor.
*
@@ -95,7 +99,8 @@ class RequestHandlerController extends OCSController {
Notifications $notifications,
AddressHandler $addressHandler,
IUserManager $userManager,
- ICloudIdManager $cloudIdManager
+ ICloudIdManager $cloudIdManager,
+ ILogger $logger
) {
parent::__construct($appName, $request);
@@ -106,6 +111,7 @@ class RequestHandlerController extends OCSController {
$this->addressHandler = $addressHandler;
$this->userManager = $userManager;
$this->cloudIdManager = $cloudIdManager;
+ $this->logger = $logger;
}
/**
@@ -140,14 +146,13 @@ class RequestHandlerController extends OCSController {
}
// FIXME this should be a method in the user management instead
- $logger = \OC::$server->getLogger();
- $logger->debug('shareWith before, ' . $shareWith, ['app' => 'files_sharing']);
+ $this->logger->debug('shareWith before, ' . $shareWith, ['app' => 'files_sharing']);
\OCP\Util::emitHook(
'\OCA\Files_Sharing\API\Server2Server',
'preLoginNameUsedAsUserName',
array('uid' => &$shareWith)
);
- $logger->debug('shareWith after, ' . $shareWith, ['app' => 'files_sharing']);
+ $this->logger->debug('shareWith after, ' . $shareWith, ['app' => 'files_sharing']);
if (!\OC::$server->getUserManager()->userExists($shareWith)) {
throw new OCSException('User does not exists', 400);
@@ -210,7 +215,7 @@ class RequestHandlerController extends OCSController {
return new Http\DataResponse();
} catch (\Exception $e) {
- \OC::$server->getLogger()->logException($e, [
+ $this->logger->logException($e, [
'message' => 'Server can not add remote share.',
'level' => \OCP\Util::ERROR,
'app' => 'files_sharing'