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
......@@ -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);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment