aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Search
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2019-11-08 15:05:21 +0100
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-12-03 13:49:37 +0100
commitc62637da8b42ec184c252e3152bb033bd8f11561 (patch)
tree24c69bdaeb65a7900ba080cd9a1d5262efc496e1 /lib/private/Files/Search
parent2b19da84d5488ea35c6c27c26c78678fd8c5affb (diff)
downloadnextcloud-server-c62637da8b42ec184c252e3152bb033bd8f11561.tar.gz
nextcloud-server-c62637da8b42ec184c252e3152bb033bd8f11561.zip
Allow filtering the search results to the users home storage
This is done by adding a ```xml <d:eq> <d:prop> <oc:owner-id/> </d:prop> <d:literal>$userId</d:literal> </d:eq> ``` clause to the search query. Searching by `owner-id` can only be done with the current user id and the comparison can not be inside a `<d:not>` or `<d:or>` statement Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/Search')
-rw-r--r--lib/private/Files/Search/SearchQuery.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/private/Files/Search/SearchQuery.php b/lib/private/Files/Search/SearchQuery.php
index a22db2f60b3..ddad1fb49de 100644
--- a/lib/private/Files/Search/SearchQuery.php
+++ b/lib/private/Files/Search/SearchQuery.php
@@ -39,6 +39,7 @@ class SearchQuery implements ISearchQuery {
private $order;
/** @var IUser */
private $user;
+ private $limitToHome;
/**
* SearchQuery constructor.
@@ -48,13 +49,22 @@ class SearchQuery implements ISearchQuery {
* @param int $offset
* @param array $order
* @param IUser $user
+ * @param bool $limitToHome
*/
- public function __construct(ISearchOperator $searchOperation, $limit, $offset, array $order, IUser $user) {
+ public function __construct(
+ ISearchOperator $searchOperation,
+ int $limit,
+ int $offset,
+ array $order,
+ IUser $user,
+ bool $limitToHome = false
+ ) {
$this->searchOperation = $searchOperation;
$this->limit = $limit;
$this->offset = $offset;
$this->order = $order;
$this->user = $user;
+ $this->limitToHome = $limitToHome;
}
/**
@@ -91,4 +101,8 @@ class SearchQuery implements ISearchQuery {
public function getUser() {
return $this->user;
}
+
+ public function limitToHome(): bool {
+ return $this->limitToHome;
+ }
}