summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib/Connector/Sabre/FilesReportPlugin.php')
-rw-r--r--apps/dav/lib/Connector/Sabre/FilesReportPlugin.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
index 3e85615638b..f4e5de0ea43 100644
--- a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
@@ -46,6 +46,7 @@ class FilesReportPlugin extends ServerPlugin {
const NS_OWNCLOUD = 'http://owncloud.org/ns';
const REPORT_NAME = '{http://owncloud.org/ns}filter-files';
const SYSTEMTAG_PROPERTYNAME = '{http://owncloud.org/ns}systemtag';
+ const CIRCLE_PROPERTYNAME = '{http://owncloud.org/ns}circle';
/**
* Reference to main server object
@@ -256,14 +257,19 @@ class FilesReportPlugin extends ServerPlugin {
$ns = '{' . $this::NS_OWNCLOUD . '}';
$resultFileIds = null;
$systemTagIds = [];
+ $circlesIds = [];
$favoriteFilter = null;
foreach ($filterRules as $filterRule) {
if ($filterRule['name'] === $ns . 'systemtag') {
$systemTagIds[] = $filterRule['value'];
}
+ if ($filterRule['name'] === self::CIRCLE_PROPERTYNAME) {
+ $circlesIds[] = $filterRule['value'];
+ }
if ($filterRule['name'] === $ns . 'favorite') {
$favoriteFilter = true;
}
+
}
if ($favoriteFilter !== null) {
@@ -282,6 +288,15 @@ class FilesReportPlugin extends ServerPlugin {
}
}
+ if (!empty($circlesIds)) {
+ $fileIds = $this->getCirclesFileIds($circlesIds);
+ if (empty($resultFileIds)) {
+ $resultFileIds = $fileIds;
+ } else {
+ $resultFileIds = array_intersect($fileIds, $resultFileIds);
+ }
+ }
+
return $resultFileIds;
}
@@ -329,6 +344,19 @@ class FilesReportPlugin extends ServerPlugin {
}
/**
+ * @suppress PhanUndeclaredClassMethod
+ * @param array $circlesIds
+ * @return array
+ */
+ private function getCirclesFileIds(array $circlesIds) {
+ if (!\OC::$server->getAppManager()->isEnabledForUser('circles') || !class_exists('\OCA\Circles\ShareByCircleProvider')) {
+ return array();
+ }
+ return \OCA\Circles\Api\v1\Circles::getFilesForCircles($circlesIds);
+ }
+
+
+ /**
* Prepare propfind response for the given nodes
*
* @param string $filesUri $filesUri URI leading to root of the files URI,