allow more than one plugin per share type
however it does not dedupe (appears too complex/expensive while we don't havve the issue currently) Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
f7713e5f3f
commit
c55583d1b4
|
@ -198,6 +198,8 @@ class ShareesAPIController extends OCSController {
|
||||||
|
|
||||||
list($result, $hasMoreResults) = $this->collaboratorSearch->search($search, $shareTypes, $lookup, $this->limit, $this->offset);
|
list($result, $hasMoreResults) = $this->collaboratorSearch->search($search, $shareTypes, $lookup, $this->limit, $this->offset);
|
||||||
|
|
||||||
|
// extra treatment for 'exact' subarray, with a single merge expected keys might be lost
|
||||||
|
$result['exact'] = array_merge($this->result['exact'], $result['exact']);
|
||||||
$this->result = array_merge($this->result, $result);
|
$this->result = array_merge($this->result, $result);
|
||||||
$response = new DataResponse($this->result);
|
$response = new DataResponse($this->result);
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,10 @@ class Search implements ISearch {
|
||||||
private $c;
|
private $c;
|
||||||
|
|
||||||
protected $pluginList = [
|
protected $pluginList = [
|
||||||
Share::SHARE_TYPE_USER => UserPlugin::class,
|
Share::SHARE_TYPE_USER => [UserPlugin::class],
|
||||||
Share::SHARE_TYPE_GROUP => GroupPlugin::class,
|
Share::SHARE_TYPE_GROUP => [GroupPlugin::class],
|
||||||
Share::SHARE_TYPE_EMAIL => MailPlugin::class,
|
Share::SHARE_TYPE_EMAIL => [MailPlugin::class],
|
||||||
Share::SHARE_TYPE_REMOTE => RemotePlugin::class,
|
Share::SHARE_TYPE_REMOTE => [RemotePlugin::class],
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct(IContainer $c) {
|
public function __construct(IContainer $c) {
|
||||||
|
@ -55,9 +55,11 @@ class Search implements ISearch {
|
||||||
if(!isset($this->pluginList[$type])) {
|
if(!isset($this->pluginList[$type])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/** @var ISearchPlugin $searchPlugin */
|
foreach ($this->pluginList[$type] as $plugin) {
|
||||||
$searchPlugin = $this->c->resolve($this->pluginList[$type]);
|
/** @var ISearchPlugin $searchPlugin */
|
||||||
$hasMoreResults |= $searchPlugin->search($search, $limit, $offset, $searchResult);
|
$searchPlugin = $this->c->resolve($plugin);
|
||||||
|
$hasMoreResults |= $searchPlugin->search($search, $limit, $offset, $searchResult);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get from lookup server, not a separate share type
|
// Get from lookup server, not a separate share type
|
||||||
|
@ -87,6 +89,6 @@ class Search implements ISearch {
|
||||||
if($shareType === null) {
|
if($shareType === null) {
|
||||||
throw new \InvalidArgumentException('Provided ShareType is invalid');
|
throw new \InvalidArgumentException('Provided ShareType is invalid');
|
||||||
}
|
}
|
||||||
$this->pluginList[$shareType] = $pluginInfo['class'];
|
$this->pluginList[$shareType][] = $pluginInfo['class'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue