mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 04:53:26 +00:00
Move user search in push controller
This commit is contained in:
@@ -327,9 +327,18 @@ class Push implements ControllerProviderInterface
|
|||||||
$em = $app['Core']->getEntityManager();
|
$em = $app['Core']->getEntityManager();
|
||||||
$user = $app['Core']->getAuthenticatedUser();
|
$user = $app['Core']->getAuthenticatedUser();
|
||||||
|
|
||||||
$pusher = new RecordHelper\Push($app['Core'], $app['request']);
|
$query = new \User_Query(\appbox::get_instance());
|
||||||
|
|
||||||
$result = $pusher->search($request->get('query'));
|
$query->on_bases_where_i_am($user->ACL(), array('canpush'));
|
||||||
|
|
||||||
|
$query->like(\User_Query::LIKE_FIRSTNAME, $request->get('query'))
|
||||||
|
->like(\User_Query::LIKE_LASTNAME, $request->get('query'))
|
||||||
|
->like(\User_Query::LIKE_LOGIN, $request->get('query'))
|
||||||
|
->like_match(\User_Query::LIKE_MATCH_OR);
|
||||||
|
|
||||||
|
$result = $query->include_phantoms()
|
||||||
|
->limit(0, 50)
|
||||||
|
->execute()->get_results();
|
||||||
|
|
||||||
$repository = $em->getRepository('\Entities\UsrList');
|
$repository = $em->getRepository('\Entities\UsrList');
|
||||||
|
|
||||||
@@ -337,6 +346,8 @@ class Push implements ControllerProviderInterface
|
|||||||
|
|
||||||
$datas = array();
|
$datas = array();
|
||||||
|
|
||||||
|
if ($lists)
|
||||||
|
{
|
||||||
foreach ($lists as $list)
|
foreach ($lists as $list)
|
||||||
{
|
{
|
||||||
$datas[] = array(
|
$datas[] = array(
|
||||||
@@ -345,7 +356,10 @@ class Push implements ControllerProviderInterface
|
|||||||
, 'quantity' => $list->getUsers()->count()
|
, 'quantity' => $list->getUsers()->count()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
foreach ($result as $user)
|
foreach ($result as $user)
|
||||||
{
|
{
|
||||||
$datas[] = array(
|
$datas[] = array(
|
||||||
@@ -357,6 +371,7 @@ class Push implements ControllerProviderInterface
|
|||||||
, 'display_name' => $user->get_display_name()
|
, 'display_name' => $user->get_display_name()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$Json = $app['Core']['Serializer']->serialize($datas, 'json');
|
$Json = $app['Core']['Serializer']->serialize($datas, 'json');
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user