Skip to content
Snippets Groups Projects
Commit 8c2b19d2 authored by Thomas Müller's avatar Thomas Müller
Browse files

Return proper current-user-principal on v1 endpoints - fixes #23306

parent 4c738ea9
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,10 @@ ...@@ -23,7 +23,10 @@
namespace OCA\DAV\Connector; namespace OCA\DAV\Connector;
use OCA\DAV\Connector\Sabre\DavAclPlugin; use OCA\DAV\Connector\Sabre\DavAclPlugin;
use Sabre\DAV\INode;
use Sabre\DAV\PropFind;
use Sabre\HTTP\URLUtil; use Sabre\HTTP\URLUtil;
use Sabre\DAVACL\Xml\Property\Principal;
class LegacyDAVACL extends DavAclPlugin { class LegacyDAVACL extends DavAclPlugin {
...@@ -67,4 +70,16 @@ class LegacyDAVACL extends DavAclPlugin { ...@@ -67,4 +70,16 @@ class LegacyDAVACL extends DavAclPlugin {
} }
return "principals/$name"; 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);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment