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:
@@ -107,7 +107,7 @@ class Push implements ControllerProviderInterface
|
||||
$BasketElement->setBasket($Basket);
|
||||
|
||||
|
||||
if($receiver['HD'])
|
||||
if ($receiver['HD'])
|
||||
{
|
||||
$user_receiver->ACL()->grant_hd_on(
|
||||
$BasketElement->getRecord()
|
||||
@@ -237,7 +237,7 @@ class Push implements ControllerProviderInterface
|
||||
{
|
||||
$participant_user = \User_Adapter::getInstance($participant['usr_id'], $appbox);
|
||||
}
|
||||
catch(\Exception $e)
|
||||
catch (\Exception $e)
|
||||
{
|
||||
throw new ControllerException(sprintf(_('Unknown user %d'), $receiver['usr_id']));
|
||||
}
|
||||
@@ -268,7 +268,7 @@ class Push implements ControllerProviderInterface
|
||||
$validationData->setBasketElement($BasketElement);
|
||||
$BasketElement->addValidationData($ValidationData);
|
||||
|
||||
if($participant['HD'])
|
||||
if ($participant['HD'])
|
||||
{
|
||||
$participant_user->ACL()->grant_hd_on(
|
||||
$BasketElement->getRecord()
|
||||
@@ -327,9 +327,18 @@ class Push implements ControllerProviderInterface
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$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');
|
||||
|
||||
@@ -337,6 +346,8 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
$datas = array();
|
||||
|
||||
if ($lists)
|
||||
{
|
||||
foreach ($lists as $list)
|
||||
{
|
||||
$datas[] = array(
|
||||
@@ -345,7 +356,10 @@ class Push implements ControllerProviderInterface
|
||||
, 'quantity' => $list->getUsers()->count()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($result)
|
||||
{
|
||||
foreach ($result as $user)
|
||||
{
|
||||
$datas[] = array(
|
||||
@@ -357,6 +371,7 @@ class Push implements ControllerProviderInterface
|
||||
, 'display_name' => $user->get_display_name()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$Json = $app['Core']['Serializer']->serialize($datas, 'json');
|
||||
|
||||
|
Reference in New Issue
Block a user