Refactor PersonSearch and create PersonACLAwareRepository

The search api delegates the query to a person acl aware "repository"
(although this does not implements ObjectRepository interface).
This commit is contained in:
2021-09-10 17:44:01 +02:00
parent f87f03b5c0
commit 6bc83edfe9
10 changed files with 497 additions and 416 deletions

View File

@@ -3,6 +3,7 @@
namespace Chill\MainBundle;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Chill\MainBundle\Search\SearchInterface;
use Chill\MainBundle\Security\Resolver\CenterResolverInterface;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;

View File

@@ -23,45 +23,44 @@ namespace Chill\MainBundle\Search;
/**
* This interface must be implemented on services which provide search results.
*
*
* @todo : write doc and add a link to documentation
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*
*/
interface SearchInterface
{
const SEARCH_PREVIEW_OPTION = '_search_preview';
/**
* Request parameters contained inside the `add_q` parameters
*/
const REQUEST_QUERY_PARAMETERS = '_search_parameters';
/**
* Supplementary parameters to the query string
*/
const REQUEST_QUERY_KEY_ADD_PARAMETERS = 'add_q';
/**
/**
* return the result in a html string. The string will be inclued (as raw)
* into a global view.
*
*
* The global view may be :
* {% for result as resultsFromDifferentSearchInterface %}
* {{ result|raw }}
* {% endfor %}
*
*
* **available options** :
* - SEARCH_PREVIEW_OPTION (boolean) : if renderResult should return a "preview" of
* - SEARCH_PREVIEW_OPTION (boolean) : if renderResult should return a "preview" of
* the results. In this case, a subset of results should be returned, and,
* if the query return more results, a button "see all results" should be
* displayed at the end of the list.
*
* **Interaction between `start` and `limit` and pagination : you should
* take only the given parameters into account; the results from pagination
* should be ignored. (Most of the time, it should be the same).
*
* **Interaction between `start` and `limit` and pagination : you should
* take only the given parameters into account; the results from pagination
* should be ignored. (Most of the time, it should be the same).
*
* @param array $terms the string to search
* @param int $start the first result (for pagination)
@@ -72,10 +71,10 @@ interface SearchInterface
*/
public function renderResult(array $terms, $start=0, $limit=50, array $options = array(), $format = 'html');
/**
/**
* we may desactive the search interface by default. in this case,
* the search will be launch and rendered only with "advanced search"
*
* the search will be launch and rendered only with "advanced search"
*
* this may be activated/desactived from bundle definition in config.yml
*
* @return bool
@@ -84,18 +83,18 @@ interface SearchInterface
/**
* the order in which the results will appears in the global view
*
*
* (this may be eventually defined in config.yml)
*
* @return int
*
* @return int
*/
public function getOrder();
/**
* indicate if the implementation supports the given domain
*
*
* @return boolean
*/
public function supports($domain, $format);
}