fix cs + read remote calendar based on user access

This commit is contained in:
2022-05-09 13:36:59 +02:00
parent 811798e23f
commit 8abce5ab85
17 changed files with 189 additions and 115 deletions

View File

@@ -45,7 +45,7 @@ class RemoteCalendarConnectAzureController
return $this->clientRegistry
->getClient('azure') // key used in config/packages/knpu_oauth2_client.yaml
->redirect([
'https://graph.microsoft.com/.default'
'https://graph.microsoft.com/.default', 'offline_access',
]);
}

View File

@@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Chill\CalendarBundle\Controller;
use Chill\CalendarBundle\Synchro\Connector\MSGraph\RemoteEventConverter;
use Chill\CalendarBundle\Synchro\Connector\RemoteCalendarConnectorInterface;
use Chill\MainBundle\Entity\User;
use DateTimeImmutable;
@@ -31,7 +30,6 @@ class RemoteCalendarProxyController
private SerializerInterface $serializer;
public function __construct(RemoteCalendarConnectorInterface $remoteCalendarConnector, SerializerInterface $serializer)
{
$this->remoteCalendarConnector = $remoteCalendarConnector;
@@ -45,8 +43,9 @@ class RemoteCalendarProxyController
{
if ($request->query->has('startDate')) {
$startDate = DateTimeImmutable::createFromFormat('Y-m-d', $request->query->get('startDate'));
if (false === $startDate) {
throw new BadRequestHttpException("startDate on bad format");
throw new BadRequestHttpException('startDate on bad format');
}
} else {
throw new BadRequestHttpException('startDate not provided');
@@ -54,8 +53,9 @@ class RemoteCalendarProxyController
if ($request->query->has('endDate')) {
$endDate = DateTimeImmutable::createFromFormat('Y-m-d', $request->query->get('endDate'));
if (false === $endDate) {
throw new BadRequestHttpException("endDate on bad format");
throw new BadRequestHttpException('endDate on bad format');
}
} else {
throw new BadRequestHttpException('endDate not provided');