[wip] first impl for getting authorization for admin

This commit is contained in:
2022-05-05 21:31:11 +02:00
parent a7ec843509
commit 5331f1becc
9 changed files with 278 additions and 4 deletions

View File

@@ -0,0 +1,41 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\CalendarBundle\Controller;
use Chill\CalendarBundle\Synchro\Connector\RemoteCalendarConnectorInterface;
use Chill\MainBundle\Entity\User;
use DateTimeImmutable;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
/**
* Contains method to get events (Calendar) from remote calendar.
*/
class RemoteCalendarProxyController
{
private RemoteCalendarConnectorInterface $remoteCalendarConnector;
public function listEventForCalendar(User $user, Request $request): Response
{
if ($request->query->has('startDate')) {
$startDate = DateTimeImmutable::createFromFormat('Y-m-dTHis', $request->query->get('startDate') . '000000');
} else {
throw new BadRequestHttpException('startDate not provided');
}
if ($request->query->has('endDate')) {
$startDate = DateTimeImmutable::createFromFormat('Y-m-dTHis', $request->query->get('endDate') . '000000');
} else {
throw new BadRequestHttpException('endDate not provided');
}
}
}