rdv: fix regression with multiple groups for property on calendar

This commit is contained in:
nobohan
2021-08-19 16:00:37 +02:00
parent 65bce1aacb
commit 6a609eb1ab
2 changed files with 17 additions and 4 deletions

View File

@@ -9,13 +9,25 @@ use Symfony\Component\HttpFoundation\Request;
class CalendarAPIController extends ApiController
{
protected function getContextForSerialization(string $action, Request $request, string $_format, $entity): array
{
switch($action) {
case '_index':
switch ($request->getMethod()) {
case Request::METHOD_GET:
return [ 'groups' => [ 'calendar:read' ] ];
}
}
return parent::getContextForSerialization($action, $request, $_format, $entity);
}
protected function customizeQuery(string $action, Request $request, $qb): void
{
if ($request->query->has('main_user')) {
$qb->where('e.mainUser = :main_user')
->setParameter('main_user', $request->query->get('main_user'));
}
}