Skip to content

Commit

Permalink
User and owner filter
Browse files Browse the repository at this point in the history
The use of "keyword" will allow the search key to be exact, Elasticsearch will not perform any transformations. This use case will consider external user sources (LDAP), where the username may have dashes or symbols that could be misinterpreted by the engine.

Signed-off-by: Silvio <[email protected]>
  • Loading branch information
silvioq authored Jan 10, 2023
1 parent 4a8a518 commit cfe1ee7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Service/SearchMappingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,9 @@ private function generateQueryContentFields(ISearchRequest $request, QueryConten
private function generateSearchQueryAccess(IDocumentAccess $access): array {

$query = [];
$query[] = ['term' => ['owner' => $access->getViewerId()]];
$query[] = ['term' => ['users' => $access->getViewerId()]];
$query[] = ['term' => ['users' => '__all']];
$query[] = ['term' => ['owner.keyword' => $access->getViewerId()]];
$query[] = ['term' => ['users.keyword' => $access->getViewerId()]];
$query[] = ['term' => ['users.keyword' => '__all']];

foreach ($access->getGroups() as $group) {
$query[] = ['term' => ['groups' => $group]];
Expand Down

0 comments on commit cfe1ee7

Please sign in to comment.