Skip to content

Commit

Permalink
feat(dav): Support parentid node property
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Ng <[email protected]>
  • Loading branch information
Pytal committed Jul 18, 2024
1 parent 4ad211b commit 42d0a59
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apps/dav/lib/Connector/Sabre/FilesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class FilesPlugin extends ServerPlugin {
public const SUBFILE_COUNT_PROPERTYNAME = '{http://nextcloud.org/ns}contained-file-count';
public const FILE_METADATA_PREFIX = '{http://nextcloud.org/ns}metadata-';
public const HIDDEN_PROPERTYNAME = '{http://nextcloud.org/ns}hidden';
public const PARENTID_PROPERTYNAME = '{http://nextcloud.org/ns}parentid';

/** Reference to main server object */
private ?Server $server = null;
Expand Down Expand Up @@ -123,6 +124,7 @@ public function initialize(Server $server) {
$server->protectedProperties[] = self::MOUNT_TYPE_PROPERTYNAME;
$server->protectedProperties[] = self::IS_ENCRYPTED_PROPERTYNAME;
$server->protectedProperties[] = self::SHARE_NOTE;
$server->protectedProperties[] = self::PARENTID_PROPERTYNAME;

// normally these cannot be changed (RFC4918), but we want them modifiable through PROPPATCH
$allowedProperties = ['{DAV:}getetag'];
Expand Down Expand Up @@ -386,6 +388,10 @@ public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node)
$propFind->handle(self::DISPLAYNAME_PROPERTYNAME, function () use ($node) {
return $node->getName();
});

$propFind->handle(self::PARENTID_PROPERTYNAME, function () use ($node) {
return $node->getNode()->getParentId();
});
}

if ($node instanceof \OCA\DAV\Connector\Sabre\File) {
Expand Down

0 comments on commit 42d0a59

Please sign in to comment.