mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
Fixed: [calendar] refactor ACL on calendar
This commit is contained in:
@@ -18,6 +18,7 @@ use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||
use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
|
||||
use Chill\MainBundle\Entity\HasCentersInterface;
|
||||
use Chill\MainBundle\Entity\Location;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
@@ -48,7 +49,7 @@ use function in_array;
|
||||
* "chill_calendar_calendar": Calendar::class
|
||||
* })
|
||||
*/
|
||||
class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCentersInterface
|
||||
{
|
||||
use RemoteCalendarTrait;
|
||||
|
||||
@@ -312,6 +313,20 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this->cancelReason;
|
||||
}
|
||||
|
||||
public function getCenters(): ?iterable
|
||||
{
|
||||
switch ($this->getContext()) {
|
||||
case 'person':
|
||||
return [$this->getPerson()->getCenter()];
|
||||
|
||||
case 'accompanying_period':
|
||||
return $this->getAccompanyingPeriod()->getCenters();
|
||||
|
||||
default:
|
||||
throw new LogicException('context not supported: ' . $this->getContext());
|
||||
}
|
||||
}
|
||||
|
||||
public function getComment(): CommentEmbeddable
|
||||
{
|
||||
return $this->comment;
|
||||
|
Reference in New Issue
Block a user