mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
73 lines
1.4 KiB
PHP
73 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/*
|
|
* 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.
|
|
*/
|
|
|
|
namespace Chill\TaskBundle\Security\Authorization;
|
|
|
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
|
use Chill\PersonBundle\Entity\Person;
|
|
use Chill\TaskBundle\Entity\AbstractTask;
|
|
use Symfony\Component\EventDispatcher\Event;
|
|
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
|
|
class AuthorizationEvent extends Event
|
|
{
|
|
public const VOTE = 'chill_task.vote';
|
|
|
|
/**
|
|
* @var bool
|
|
*/
|
|
protected $vote;
|
|
|
|
public function __construct(
|
|
private Person|AbstractTask|AccompanyingPeriod|null $subject,
|
|
private string $attribute,
|
|
private TokenInterface $token
|
|
) {
|
|
}
|
|
|
|
public function getAttribute()
|
|
{
|
|
return $this->attribute;
|
|
}
|
|
|
|
public function getSubject()
|
|
{
|
|
return $this->subject;
|
|
}
|
|
|
|
public function getToken(): TokenInterface
|
|
{
|
|
return $this->token;
|
|
}
|
|
|
|
public function getVote()
|
|
{
|
|
return $this->vote;
|
|
}
|
|
|
|
public function hasVote()
|
|
{
|
|
return null !== $this->vote;
|
|
}
|
|
|
|
public function removeVote()
|
|
{
|
|
$this->vote = null;
|
|
}
|
|
|
|
public function setVote($vote)
|
|
{
|
|
$this->vote = $vote;
|
|
|
|
return $this;
|
|
}
|
|
}
|