-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dav): add systemtag object IDs listing
Signed-off-by: skjnldsv <[email protected]>
- Loading branch information
Showing
9 changed files
with
133 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
/** | ||
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
namespace OCA\DAV\SystemTag; | ||
|
||
use OCP\SystemTag\ISystemTag; | ||
use OCP\SystemTag\ISystemTagManager; | ||
use OCP\SystemTag\ISystemTagObjectMapper; | ||
use Sabre\DAV\Exception\MethodNotAllowed; | ||
|
||
/** | ||
* SystemTagObjectType property | ||
* This property represent a type of object which tags are assigned to. | ||
*/ | ||
class SystemTagObjectType implements \Sabre\DAV\INode { | ||
public const NS_NEXTCLOUD = 'http://nextcloud.org/ns'; | ||
|
||
/** @var string[] */ | ||
private array $objectsIds = []; | ||
|
||
public function __construct( | ||
private ISystemTag $tag, | ||
private string $type, | ||
private ISystemTagManager $tagManager, | ||
private ISystemTagObjectMapper $tagMapper, | ||
) { | ||
} | ||
|
||
/** | ||
* Get the list of object ids that have this tag assigned. | ||
* @return string | ||
*/ | ||
public function getObjectsIds(): array { | ||
if (empty($this->objectsIds)) { | ||
$this->objectsIds = $this->tagMapper->getObjectIdsForTags($this->tag->getId(), $this->type); | ||
} | ||
|
||
return $this->objectsIds; | ||
} | ||
|
||
public function delete() { | ||
throw new MethodNotAllowed(); | ||
} | ||
|
||
public function getName() { | ||
return $this->type; | ||
} | ||
|
||
public function setName($name) { | ||
throw new MethodNotAllowed(); | ||
} | ||
|
||
public function getLastModified() { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters