aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions/lib/Sabre/RootCollection.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_versions/lib/Sabre/RootCollection.php')
-rw-r--r--apps/files_versions/lib/Sabre/RootCollection.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/files_versions/lib/Sabre/RootCollection.php b/apps/files_versions/lib/Sabre/RootCollection.php
index ed4df7fed63..835df5930bc 100644
--- a/apps/files_versions/lib/Sabre/RootCollection.php
+++ b/apps/files_versions/lib/Sabre/RootCollection.php
@@ -27,6 +27,7 @@ use OCA\Files_Versions\Versions\IVersionManager;
use OCP\Files\IRootFolder;
use OCP\IConfig;
use OCP\IUserManager;
+use OCP\IUserSession;
use Sabre\DAV\INode;
use Sabre\DAVACL\AbstractPrincipalCollection;
use Sabre\DAVACL\PrincipalBackend;
@@ -42,18 +43,23 @@ class RootCollection extends AbstractPrincipalCollection {
/** @var IVersionManager */
private $versionManager;
+ /** @var IUserSession */
+ private $userSession;
+
public function __construct(
PrincipalBackend\BackendInterface $principalBackend,
IRootFolder $rootFolder,
IConfig $config,
IUserManager $userManager,
- IVersionManager $versionManager
+ IVersionManager $versionManager,
+ IUserSession $userSession
) {
parent::__construct($principalBackend, 'principals/users');
$this->rootFolder = $rootFolder;
$this->userManager = $userManager;
$this->versionManager = $versionManager;
+ $this->userSession = $userSession;
$this->disableListing = !$config->getSystemValue('debug', false);
}
@@ -70,7 +76,7 @@ class RootCollection extends AbstractPrincipalCollection {
*/
public function getChildForPrincipal(array $principalInfo) {
[, $name] = \Sabre\Uri\split($principalInfo['uri']);
- $user = \OC::$server->getUserSession()->getUser();
+ $user = $this->userSession->getUser();
if (is_null($user) || $name !== $user->getUID()) {
throw new \Sabre\DAV\Exception\Forbidden();
}