diff --git a/src/Application/Actions/Search/SearchAction.php b/src/Application/Actions/Search/SearchAction.php index 06fc138dac919d8a9b80cf57d7058deb46abf7da..9fc4aa2a1daf1094f6068a9a705d5239318dde36 100644 --- a/src/Application/Actions/Search/SearchAction.php +++ b/src/Application/Actions/Search/SearchAction.php @@ -45,7 +45,15 @@ class SearchAction extends Action $groups_query = $this->groupRepository->createQueryBuilder('g'); $groups_list = $groups_query ->where('g.name LIKE :search') - ->setParameter('search', '%' . $search . '%') + ->andWhere($groups_query->expr()->orX( + $groups_query->expr()->eq('g.private', '0'), + $groups_query->expr()->isMemberOf(':user_id', 'g.users') + + )) + ->setParameters(array( + ':user_id' => $_SESSION['userId'], + ':search' => '%' . $search . '%' + )) ->getQuery() ->getResult();