Implement ISearchableGroupBackend

Signed-off-by: Claus-Justus Heine <himself@claus-justus-heine.de>
This commit is contained in:
Claus-Justus Heine
2023-08-22 12:35:26 +02:00
parent 662b849ed9
commit 7da80d207a
5 changed files with 115 additions and 12 deletions

View File

@@ -92,10 +92,33 @@ class GroupRepository
$gid, $search = "", $limit = -1, $offset = 0
) {
return $this->dataQuery->queryColumn(
Query::FIND_GROUP_UIDS,
[Query::GID_PARAM => $gid, Query::SEARCH_PARAM => $search], $limit,
$offset
);
}
/**
* Get a list of all user IDs and their display-name belonging to the group.
*
* @param string $gid The group ID.
* @param string $search The UID search term. Defaults to "" (empty string).
* @param int $limit (optional) Results limit.
* Defaults to -1 (no limit).
* @param int $offset (optional) Results offset. Defaults to 0.
*
* @return array<string, string> Array of display-names indexed by UIDs belonging to the group
* or FALSE on failure.
*/
public function findAllUsersBySearchTerm(
$gid, $search = "", $limit = -1, $offset = 0
) {
$data = $this->dataQuery->queryColumns(
Query::FIND_GROUP_USERS,
[Query::GID_PARAM => $gid, Query::SEARCH_PARAM => $search], $limit,
$offset
);
return array_column($data, QUERY::NAME_PARAM, Query::UID_PARAM);
}
/**