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-31 09:05:39 +0200 |
commit | cb300d164ec14dd886dc41609cdb8c27cdf557e9 (patch) | |
tree | d5d6ee01ac81228acda41475f275130843f8856b /apps/dav | |
parent | e664e582fb0c4878186001b84448dfa1c7034789 (diff) | |
download | nextcloud-server-cb300d164ec14dd886dc41609cdb8c27cdf557e9.tar.gz nextcloud-server-cb300d164ec14dd886dc41609cdb8c27cdf557e9.zip |
Return proper current-user-principal on v1 endpoints - fixes #23306
Diffstat (limited to 'apps/dav')
-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); + } } |