Revert "Merge branch 'signature-app/wp-576-restorestored-object-version' into 'master'"

This reverts merge request !586
This commit is contained in:
2024-09-19 13:26:12 +00:00
parent 671bb6d593
commit e4d0705e84
1701 changed files with 14541 additions and 35017 deletions

View File

@@ -18,8 +18,9 @@ class AdminController extends AbstractController
{
/**
* Calendar admin.
*
* @Route("/{_locale}/admin/calendar", name="chill_calendar_admin_index")
*/
#[Route(path: '/{_locale}/admin/calendar', name: 'chill_calendar_admin_index')]
public function indexAdminAction()
{
return $this->render('@ChillCalendar/Admin/index.html.twig');

View File

@@ -23,9 +23,16 @@ use Symfony\Component\Routing\Annotation\Route;
class CalendarAPIController extends ApiController
{
public function __construct(private readonly CalendarRepository $calendarRepository) {}
public function __construct(private readonly CalendarRepository $calendarRepository)
{
}
#[Route(path: '/api/1.0/calendar/calendar/by-user/{id}.{_format}', name: 'chill_api_single_calendar_list_by-user', requirements: ['_format' => 'json'])]
/**
* @Route("/api/1.0/calendar/calendar/by-user/{id}.{_format}",
* name="chill_api_single_calendar_list_by-user",
* requirements={"_format": "json"}
* )
*/
public function listByUser(User $user, Request $request, string $_format): JsonResponse
{
$this->denyAccessUnlessGranted('ROLE_USER');

View File

@@ -59,16 +59,17 @@ class CalendarController extends AbstractController
private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository,
private readonly UserRepositoryInterface $userRepository,
private readonly TranslatorInterface $translator,
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry,
) {}
) {
}
/**
* Delete a calendar item.
*
* @Route("/{_locale}/calendar/{id}/delete", name="chill_calendar_calendar_delete")
*/
#[Route(path: '/{_locale}/calendar/{id}/delete', name: 'chill_calendar_calendar_delete')]
public function deleteAction(Request $request, Calendar $entity)
{
$em = $this->managerRegistry->getManager();
$em = $this->getDoctrine()->getManager();
[$person, $accompanyingPeriod] = [$entity->getPerson(), $entity->getAccompanyingPeriod()];
@@ -84,7 +85,7 @@ class CalendarController extends AbstractController
$form = $this->createDeleteForm($entity);
if (Request::METHOD_POST === $request->getMethod()) {
if (Request::METHOD_DELETE === $request->getMethod()) {
$form->handleRequest($request);
if ($form->isValid()) {
@@ -113,8 +114,9 @@ class CalendarController extends AbstractController
/**
* Edit a calendar item.
*
* @Route("/{_locale}/calendar/calendar/{id}/edit", name="chill_calendar_calendar_edit")
*/
#[Route(path: '/{_locale}/calendar/calendar/{id}/edit', name: 'chill_calendar_calendar_edit')]
public function editAction(Calendar $entity, Request $request): Response
{
$this->denyAccessUnlessGranted(CalendarVoter::EDIT, $entity);
@@ -123,7 +125,7 @@ class CalendarController extends AbstractController
return $this->remoteCalendarConnector->getMakeReadyResponse($request->getUri());
}
$em = $this->managerRegistry->getManager();
$em = $this->getDoctrine()->getManager();
[$person, $accompanyingPeriod] = [$entity->getPerson(), $entity->getAccompanyingPeriod()];
@@ -192,8 +194,9 @@ class CalendarController extends AbstractController
/**
* Lists all Calendar entities.
*
* @Route("/{_locale}/calendar/calendar/by-period/{id}", name="chill_calendar_calendar_list_by_period")
*/
#[Route(path: '/{_locale}/calendar/calendar/by-period/{id}', name: 'chill_calendar_calendar_list_by_period')]
public function listActionByCourse(AccompanyingPeriod $accompanyingPeriod): Response
{
$this->denyAccessUnlessGranted(CalendarVoter::SEE, $accompanyingPeriod);
@@ -225,8 +228,9 @@ class CalendarController extends AbstractController
/**
* Lists all Calendar entities on a person.
*
* @Route("/{_locale}/calendar/calendar/by-person/{id}", name="chill_calendar_calendar_list_by_person")
*/
#[Route(path: '/{_locale}/calendar/calendar/by-person/{id}', name: 'chill_calendar_calendar_list_by_person')]
public function listActionByPerson(Person $person): Response
{
$this->denyAccessUnlessGranted(CalendarVoter::SEE, $person);
@@ -256,7 +260,9 @@ class CalendarController extends AbstractController
]);
}
#[Route(path: '/{_locale}/calendar/calendar/my', name: 'chill_calendar_calendar_list_my')]
/**
* @Route("/{_locale}/calendar/calendar/my", name="chill_calendar_calendar_list_my")
*/
public function myCalendar(Request $request): Response
{
$this->denyAccessUnlessGranted('ROLE_USER');
@@ -278,8 +284,9 @@ class CalendarController extends AbstractController
/**
* Create a new calendar item.
*
* @Route("/{_locale}/calendar/calendar/new", name="chill_calendar_calendar_new")
*/
#[Route(path: '/{_locale}/calendar/calendar/new', name: 'chill_calendar_calendar_new')]
public function newAction(Request $request): Response
{
if (!$this->remoteCalendarConnector->isReady()) {
@@ -287,7 +294,7 @@ class CalendarController extends AbstractController
}
$view = null;
$em = $this->managerRegistry->getManager();
$em = $this->getDoctrine()->getManager();
[$person, $accompanyingPeriod] = $this->getEntity($request);
@@ -378,13 +385,14 @@ class CalendarController extends AbstractController
/**
* Show a calendar item.
*
* @Route("/{_locale}/calendar/calendar/{id}/show", name="chill_calendar_calendar_show")
*/
#[Route(path: '/{_locale}/calendar/calendar/{id}/show', name: 'chill_calendar_calendar_show')]
public function showAction(Request $request, int $id): Response
{
throw new \Exception('not implemented');
$view = null;
$em = $this->managerRegistry->getManager();
$em = $this->getDoctrine()->getManager();
[$user, $accompanyingPeriod] = $this->getEntity($request);
@@ -447,7 +455,9 @@ class CalendarController extends AbstractController
]);
}
#[Route(path: '/{_locale}/calendar/calendar/{id}/to-activity', name: 'chill_calendar_calendar_to_activity')]
/**
* @Route("/{_locale}/calendar/calendar/{id}/to-activity", name="chill_calendar_calendar_to_activity")
*/
public function toActivity(Request $request, Calendar $calendar): RedirectResponse
{
$this->denyAccessUnlessGranted(CalendarVoter::SEE, $calendar);
@@ -512,6 +522,7 @@ class CalendarController extends AbstractController
{
return $this->createFormBuilder()
->setAction($this->generateUrl('chill_calendar_calendar_delete', ['id' => $calendar->getId()]))
->setMethod('DELETE')
->add('submit', SubmitType::class, ['label' => 'Delete'])
->getForm();
}
@@ -521,7 +532,7 @@ class CalendarController extends AbstractController
*/
private function getEntity(Request $request): array
{
$em = $this->managerRegistry->getManager();
$em = $this->getDoctrine()->getManager();
$person = $accompanyingPeriod = null;
if ($request->query->has('person_id')) {

View File

@@ -35,9 +35,12 @@ final readonly class CalendarDocController
private FormFactoryInterface $formFactory,
private Security $security,
private UrlGeneratorInterface $urlGenerator,
) {}
) {
}
#[Route(path: '/{_locale}/calendar/calendar-doc/{id}/new', name: 'chill_calendar_calendardoc_new')]
/**
* @Route("/{_locale}/calendar/calendar-doc/{id}/new", name="chill_calendar_calendardoc_new")
*/
public function create(Calendar $calendar, Request $request): Response
{
$calendarDoc = (new CalendarDoc($calendar, null))->setCalendar($calendar);
@@ -94,7 +97,9 @@ final readonly class CalendarDocController
);
}
#[Route(path: '/{_locale}/calendar/calendar-doc/{id}/delete', name: 'chill_calendar_calendardoc_delete')]
/**
* @Route("/{_locale}/calendar/calendar-doc/{id}/delete", name="chill_calendar_calendardoc_delete")
*/
public function delete(CalendarDoc $calendarDoc, Request $request): Response
{
if (!$this->security->isGranted(CalendarDocVoter::EDIT, $calendarDoc)) {
@@ -152,7 +157,9 @@ final readonly class CalendarDocController
);
}
#[Route(path: '/{_locale}/calendar/calendar-doc/{id}/edit', name: 'chill_calendar_calendardoc_edit')]
/**
* @Route("/{_locale}/calendar/calendar-doc/{id}/edit", name="chill_calendar_calendardoc_edit")
*/
public function edit(CalendarDoc $calendarDoc, Request $request): Response
{
if (!$this->security->isGranted(CalendarDocVoter::EDIT, $calendarDoc)) {

View File

@@ -23,9 +23,16 @@ use Symfony\Component\Routing\Annotation\Route;
class CalendarRangeAPIController extends ApiController
{
public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository) {}
public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository)
{
}
#[Route(path: '/api/1.0/calendar/calendar-range-available/{id}.{_format}', name: 'chill_api_single_calendar_range_available', requirements: ['_format' => 'json'])]
/**
* @Route("/api/1.0/calendar/calendar-range-available/{id}.{_format}",
* name="chill_api_single_calendar_range_available",
* requirements={"_format": "json"}
* )
*/
public function availableRanges(User $user, Request $request, string $_format): JsonResponse
{
// return new JsonResponse(['ok' => true], 200, [], false);

View File

@@ -34,12 +34,15 @@ use Symfony\Component\Security\Core\Security;
class InviteApiController
{
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly MessageBusInterface $messageBus, private readonly Security $security) {}
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly MessageBusInterface $messageBus, private readonly Security $security)
{
}
/**
* Give an answer to a calendar invite.
*
* @Route("/api/1.0/calendar/calendar/{id}/answer/{answer}.json", methods={"post"})
*/
#[Route(path: '/api/1.0/calendar/calendar/{id}/answer/{answer}.json', methods: ['post'])]
public function answer(Calendar $calendar, string $answer): Response
{
$user = $this->security->getUser();

View File

@@ -30,9 +30,13 @@ use TheNetworg\OAuth2\Client\Token\AccessToken;
class RemoteCalendarConnectAzureController
{
public function __construct(private readonly ClientRegistry $clientRegistry, private readonly OnBehalfOfUserTokenStorage $MSGraphTokenStorage) {}
public function __construct(private readonly ClientRegistry $clientRegistry, private readonly OnBehalfOfUserTokenStorage $MSGraphTokenStorage)
{
}
#[Route(path: '/{_locale}/connect/azure', name: 'chill_calendar_remote_connect_azure')]
/**
* @Route("/{_locale}/connect/azure", name="chill_calendar_remote_connect_azure")
*/
public function connectAzure(Request $request): Response
{
$request->getSession()->set('azure_return_path', $request->query->get('returnPath', '/'));
@@ -42,7 +46,9 @@ class RemoteCalendarConnectAzureController
->redirect(['https://graph.microsoft.com/.default', 'offline_access'], []);
}
#[Route(path: '/connect/azure/check', name: 'chill_calendar_remote_connect_azure_check')]
/**
* @Route("/connect/azure/check", name="chill_calendar_remote_connect_azure_check")
*/
public function connectAzureCheck(Request $request): Response
{
/** @var Azure $client */

View File

@@ -27,9 +27,14 @@ use Symfony\Component\Routing\Annotation\Route;
class RemoteCalendarMSGraphSyncController
{
public function __construct(private readonly MessageBusInterface $messageBus) {}
public function __construct(private readonly MessageBusInterface $messageBus)
{
}
#[Route(path: '/public/incoming-hook/calendar/msgraph/events/{userId}', name: 'chill_calendar_remote_msgraph_incoming_webhook_events', methods: ['POST'])]
/**
* @Route("/public/incoming-hook/calendar/msgraph/events/{userId}", name="chill_calendar_remote_msgraph_incoming_webhook_events",
* methods={"POST"})
*/
public function webhookCalendarReceiver(int $userId, Request $request): Response
{
if ($request->query->has('validationToken')) {

View File

@@ -34,9 +34,13 @@ use Symfony\Component\Serializer\SerializerInterface;
*/
class RemoteCalendarProxyController
{
public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly SerializerInterface $serializer) {}
public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly SerializerInterface $serializer)
{
}
#[Route(path: 'api/1.0/calendar/proxy/calendar/by-user/{id}/events')]
/**
* @Route("api/1.0/calendar/proxy/calendar/by-user/{id}/events")
*/
public function listEventForCalendar(User $user, Request $request): Response
{
if (!$request->query->has('dateFrom')) {