Skip to content

Commit

Permalink
Merge branch '6.x' into chore/composer.json
Browse files Browse the repository at this point in the history
  • Loading branch information
theus77 authored Dec 27, 2023
2 parents b92d6eb + 2c01dbc commit 657c576
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
6 changes: 3 additions & 3 deletions EMS/client-helper-bundle/src/Helper/Routing/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ private function resolveOptions(array $options): array
'defaults' => [],
'requirements' => [],
'options' => [],
'host' => null,
'schemes' => null,
'host' => '',
'schemes' => [],
'prefix' => null,
'type' => null,
'query' => null,
'template' => '[template]',
'index_regex' => null,
'condition' => null,
'condition' => '',
])
->addAllowedTypes('method', ['string', 'string[]'])
->setNormalizer('defaults', function (Options $options, $value) {
Expand Down
7 changes: 6 additions & 1 deletion EMS/common-bundle/src/Elasticsearch/Response/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace EMS\CommonBundle\Elasticsearch\Response;

use Elastica\Query;
use Elastica\Result;
use Elastica\ResultSet;
use EMS\CommonBundle\Elasticsearch\Aggregation\Aggregation;
use EMS\CommonBundle\Elasticsearch\Document\Document;
Expand Down Expand Up @@ -152,7 +153,11 @@ public function buildResultSet(Query $query, string $version): ResultSet
],
], 200);
$response->getData();
$results = [];
foreach ($this->hits as $hit) {
$results[] = new Result($hit);
}

return new ResultSet($response, $query, []);
return new ResultSet($response, $query, $results);
}
}
4 changes: 2 additions & 2 deletions EMS/common-bundle/src/Service/ElasticaService.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function generateSearch(array $indexes, AbstractQuery $query, array $cont
public function generateTermsSearch(array $indexes, string $field, array $terms, array $contentTypes = []): Search
{
$query = new Terms($field, $terms);
if (empty($contentTypes)) {
if (!empty($contentTypes)) {
$query = $this->filterByContentTypes($query, $contentTypes);
}

Expand Down Expand Up @@ -405,7 +405,7 @@ public function getDocument(string $index, ?string $contentType, string $id, arr
$contentTypes[] = $contentType;
}

if ($query) {
if (null !== $query) {
$search = $this->generateSearch([$index], $query, $contentTypes);
} else {
$search = $this->generateTermsSearch([$index], '_id', [$id], $contentTypes);
Expand Down
10 changes: 10 additions & 0 deletions EMS/core-bundle/src/Security/Ldap/LdapUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Symfony\Component\Ldap\Security\LdapUser;
use Symfony\Component\Ldap\Security\LdapUserProvider as SymfonyLdapUserProvider;
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
use Symfony\Component\Security\Core\User\UserInterface;

class LdapUserProvider extends SymfonyLdapUserProvider
{
Expand Down Expand Up @@ -41,4 +42,13 @@ protected function loadUser(string $identifier, Entry $entry): User

return $user ?: LdapCoreUserFactory::create($ldapUser, $this->ldapConfig);
}

public function loadUserByIdentifier(string $identifier): UserInterface
{
if ('' === $this->ldapConfig->baseDn) {
throw new UserNotFoundException(\sprintf('Ldap server not configured'));
}

return parent::loadUserByIdentifier($identifier);
}
}

0 comments on commit 657c576

Please sign in to comment.