summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-03-17 11:51:38 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-03-24 09:53:36 +0100
commit8c2b19d2bc2167e95849d7e3541f25a5519caf3b (patch)
tree9ed6a6c232bab0f1f4ad5caa3d971a7985981532
parent4c738ea9c47686e35ff6ad3e4617446849dca3c0 (diff)
downloadnextcloud-server-8c2b19d2bc2167e95849d7e3541f25a5519caf3b.tar.gz
nextcloud-server-8c2b19d2bc2167e95849d7e3541f25a5519caf3b.zip
Return proper current-user-principal on v1 endpoints - fixes #23306
-rw-r--r--apps/dav/lib/connector/legacydavacl.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/dav/lib/connector/legacydavacl.php b/apps/dav/lib/connector/legacydavacl.php
index 07aefa1b863..eb6ca1fd7d5 100644
--- a/apps/dav/lib/connector/legacydavacl.php
+++ b/apps/dav/lib/connector/legacydavacl.php
@@ -23,7 +23,10 @@
namespace OCA\DAV\Connector;
use OCA\DAV\Connector\Sabre\DavAclPlugin;
+use Sabre\DAV\INode;
+use Sabre\DAV\PropFind;
use Sabre\HTTP\URLUtil;
+use Sabre\DAVACL\Xml\Property\Principal;
class LegacyDAVACL extends DavAclPlugin {
@@ -67,4 +70,16 @@ class LegacyDAVACL extends DavAclPlugin {
}
return "principals/$name";
}
+
+ function propFind(PropFind $propFind, INode $node) {
+ /* Overload current-user-principal */
+ $propFind->handle('{DAV:}current-user-principal', function () {
+ if ($url = parent::getCurrentUserPrincipal()) {
+ return new Principal(Principal::HREF, $url . '/');
+ } else {
+ return new Principal(Principal::UNAUTHENTICATED);
+ }
+ });
+ parent::propFind($propFind, $node);
+ }
}