mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Add a mention on next calendars on search results
This commit is contained in:
@@ -84,7 +84,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
public ?User $previousMainUser = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod")
|
||||
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod", inversedBy="calendars")
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private AccompanyingPeriod $accompanyingPeriod;
|
||||
@@ -153,7 +153,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
private ?User $mainUser = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
|
||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person", inversedBy="calendars")
|
||||
* @ORM\JoinTable(name="chill_calendar.calendar_to_persons")
|
||||
* @Serializer\Groups({"calendar:read", "read"})
|
||||
* @Assert\Count(min=1, minMessage="calendar.At least {{ limit }} person is required.")
|
||||
|
@@ -458,13 +458,10 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface
|
||||
}
|
||||
|
||||
try {
|
||||
$v = $this->machineHttpClient->request(
|
||||
return $this->machineHttpClient->request(
|
||||
'GET',
|
||||
'users/' . $userId . '/calendar/events/' . $remoteId
|
||||
)->toArray();
|
||||
dump($v);
|
||||
|
||||
return $v;
|
||||
} catch (ClientExceptionInterface $e) {
|
||||
$this->logger->warning('Could not get event from calendar', [
|
||||
'remoteId' => $remoteId,
|
||||
|
@@ -11,6 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\CalendarBundle\Security\Voter;
|
||||
|
||||
use Chill\CalendarBundle\Entity\Calendar;
|
||||
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
|
||||
use Chill\MainBundle\Security\Authorization\VoterHelperFactoryInterface;
|
||||
use Chill\MainBundle\Security\Authorization\VoterHelperInterface;
|
||||
@@ -23,6 +24,12 @@ use Symfony\Component\Security\Core\Security;
|
||||
|
||||
class CalendarVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
||||
{
|
||||
public const CREATE = 'CHILL_CALENDAR_CALENDAR_CREATE';
|
||||
|
||||
public const DELETE = 'CHILL_CALENDAR_CALENDAR_DELETE';
|
||||
|
||||
public const EDIT = 'CHILL_CALENDAR_CALENDAR_EDIT';
|
||||
|
||||
public const SEE = 'CHILL_CALENDAR_CALENDAR_SEE';
|
||||
|
||||
private Security $security;
|
||||
@@ -37,6 +44,7 @@ class CalendarVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
||||
$this->voterHelper = $voterHelperFactory
|
||||
->generate(self::class)
|
||||
->addCheckFor(AccompanyingPeriod::class, [self::SEE])
|
||||
->addCheckFor(Calendar::class, [self::SEE, self::CREATE, self::EDIT, self::DELETE])
|
||||
->build();
|
||||
}
|
||||
|
||||
@@ -77,6 +85,18 @@ class CalendarVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
||||
default:
|
||||
throw new LogicException('subject not implemented');
|
||||
}
|
||||
} elseif ($subject instanceof Calendar) {
|
||||
if (null !== $period = $subject->getAccompanyingPeriod()) {
|
||||
switch ($attribute) {
|
||||
case self::SEE:
|
||||
case self::EDIT:
|
||||
case self::CREATE:
|
||||
return $this->security->isGranted(AccompanyingPeriodVoter::SEE, $period);
|
||||
|
||||
case self::DELETE:
|
||||
return $this->security->isGranted(AccompanyingPeriodVoter::EDIT, $period);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new LogicException('attribute not implemented');
|
||||
|
@@ -49,6 +49,7 @@ chill_calendar:
|
||||
start date filter: Début du rendez-vous
|
||||
From: Du
|
||||
To: Au
|
||||
Next calendars: Prochains rendez-vous
|
||||
|
||||
remote_ms_graph:
|
||||
freebusy_statuses:
|
||||
|
Reference in New Issue
Block a user