diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-17 11:51:38 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-24 09:53:36 +0100 |
commit | 8c2b19d2bc2167e95849d7e3541f25a5519caf3b (patch) | |
tree | 9ed6a6c232bab0f1f4ad5caa3d971a7985981532 | |
parent | 4c738ea9c47686e35ff6ad3e4617446849dca3c0 (diff) | |
download | nextcloud-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.php | 15 |
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); + } } |