summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib')
-rw-r--r--apps/dav/lib/Connector/Sabre/FilesPlugin.php26
-rw-r--r--apps/dav/lib/Connector/Sabre/ServerFactory.php1
-rw-r--r--apps/dav/lib/Server.php1
3 files changed, 25 insertions, 3 deletions
diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
index 2a1412a8d97..3f2ae0f35ec 100644
--- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
@@ -40,6 +40,7 @@ use OCP\Files\StorageNotAvailableException;
use OCP\IConfig;
use OCP\IPreview;
use OCP\IRequest;
+use OCP\IUserSession;
use Sabre\DAV\Exception\Forbidden;
use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\IFile;
@@ -89,6 +90,11 @@ class FilesPlugin extends ServerPlugin {
private $tree;
/**
+ * @var IUserSession
+ */
+ private $userSession;
+
+ /**
* Whether this is public webdav.
* If true, some returned information will be stripped off.
*
@@ -128,11 +134,13 @@ class FilesPlugin extends ServerPlugin {
IConfig $config,
IRequest $request,
IPreview $previewManager,
+ IUserSession $userSession,
$isPublic = false,
$downloadAttachment = true) {
$this->tree = $tree;
$this->config = $config;
$this->request = $request;
+ $this->userSession = $userSession;
$this->isPublic = $isPublic;
$this->downloadAttachment = $downloadAttachment;
$this->previewManager = $previewManager;
@@ -322,14 +330,22 @@ class FilesPlugin extends ServerPlugin {
});
$propFind->handle(self::SHARE_PERMISSIONS_PROPERTYNAME, function () use ($node, $httpRequest) {
+ $user = $this->userSession->getUser();
+ if ($user === null) {
+ return null;
+ }
return $node->getSharePermissions(
- $httpRequest->getRawServerValue('PHP_AUTH_USER')
+ $user->getUID()
);
});
$propFind->handle(self::OCM_SHARE_PERMISSIONS_PROPERTYNAME, function () use ($node, $httpRequest) {
+ $user = $this->userSession->getUser();
+ if ($user === null) {
+ return null;
+ }
$ncPermissions = $node->getSharePermissions(
- $httpRequest->getRawServerValue('PHP_AUTH_USER')
+ $user->getUID()
);
$ocmPermissions = $this->ncPermissions2ocmPermissions($ncPermissions);
return json_encode($ocmPermissions);
@@ -367,8 +383,12 @@ class FilesPlugin extends ServerPlugin {
});
$propFind->handle(self::SHARE_NOTE, function () use ($node, $httpRequest) {
+ $user = $this->userSession->getUser();
+ if ($user === null) {
+ return null;
+ }
return $node->getNoteFromShare(
- $httpRequest->getRawServerValue('PHP_AUTH_USER')
+ $user->getUID()
);
});
}
diff --git a/apps/dav/lib/Connector/Sabre/ServerFactory.php b/apps/dav/lib/Connector/Sabre/ServerFactory.php
index 5a8b109cd38..7be24014881 100644
--- a/apps/dav/lib/Connector/Sabre/ServerFactory.php
+++ b/apps/dav/lib/Connector/Sabre/ServerFactory.php
@@ -171,6 +171,7 @@ class ServerFactory {
$this->config,
$this->request,
$this->previewManager,
+ $this->userSession,
false,
!$this->config->getSystemValue('debug', false)
)
diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php
index 9193da49b48..f22cf888e1c 100644
--- a/apps/dav/lib/Server.php
+++ b/apps/dav/lib/Server.php
@@ -238,6 +238,7 @@ class Server {
\OC::$server->getConfig(),
$this->request,
\OC::$server->getPreviewManager(),
+ \OC::$server->getUserSession(),
false,
!\OC::$server->getConfig()->getSystemValue('debug', false)
)