Browse Source

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>
tags/v13.0.0beta1
Arthur Schiwon 6 years ago
parent
commit
c55583d1b4
No account linked to committer's email address

+ 2
- 0
apps/files_sharing/lib/Controller/ShareesAPIController.php View File

@@ -198,6 +198,8 @@ class ShareesAPIController extends OCSController {

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);
$response = new DataResponse($this->result);


+ 10
- 8
lib/private/Collaboration/Collaborators/Search.php View File

@@ -35,10 +35,10 @@ class Search implements ISearch {
private $c;

protected $pluginList = [
Share::SHARE_TYPE_USER => UserPlugin::class,
Share::SHARE_TYPE_GROUP => GroupPlugin::class,
Share::SHARE_TYPE_EMAIL => MailPlugin::class,
Share::SHARE_TYPE_REMOTE => RemotePlugin::class,
Share::SHARE_TYPE_USER => [UserPlugin::class],
Share::SHARE_TYPE_GROUP => [GroupPlugin::class],
Share::SHARE_TYPE_EMAIL => [MailPlugin::class],
Share::SHARE_TYPE_REMOTE => [RemotePlugin::class],
];

public function __construct(IContainer $c) {
@@ -55,9 +55,11 @@ class Search implements ISearch {
if(!isset($this->pluginList[$type])) {
continue;
}
/** @var ISearchPlugin $searchPlugin */
$searchPlugin = $this->c->resolve($this->pluginList[$type]);
$hasMoreResults |= $searchPlugin->search($search, $limit, $offset, $searchResult);
foreach ($this->pluginList[$type] as $plugin) {
/** @var ISearchPlugin $searchPlugin */
$searchPlugin = $this->c->resolve($plugin);
$hasMoreResults |= $searchPlugin->search($search, $limit, $offset, $searchResult);
}
}

// Get from lookup server, not a separate share type
@@ -87,6 +89,6 @@ class Search implements ISearch {
if($shareType === null) {
throw new \InvalidArgumentException('Provided ShareType is invalid');
}
$this->pluginList[$shareType] = $pluginInfo['class'];
$this->pluginList[$shareType][] = $pluginInfo['class'];
}
}

Loading…
Cancel
Save