upgrade AuthorizationEvent to receive other class than tasks

This commit is contained in:
Julien Fastré 2018-07-17 17:10:32 +02:00
parent ebc0961fa8
commit f9221f9f90

View File

@ -5,7 +5,6 @@
namespace Chill\TaskBundle\Security\Authorization; namespace Chill\TaskBundle\Security\Authorization;
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
use Chill\TaskBundle\Entity\AbstractTask;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
/** /**
@ -16,9 +15,9 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
class AuthorizationEvent extends Event class AuthorizationEvent extends Event
{ {
/** /**
* @var AbstractTask * @var Chill\TaskBundle\Entity\AbstractTask|\Chill\PersonBundle\Entity\Person|null
*/ */
protected $task; protected $subject;
/** /**
* *
@ -41,18 +40,18 @@ class AuthorizationEvent extends Event
const VOTE = 'chill_task.vote'; const VOTE = 'chill_task.vote';
public function __construct( public function __construct(
AbstractTask $task, $subject,
$attribute, $attribute,
TokenInterface $token TokenInterface $token
) { ) {
$this->task = $task; $this->subject = $subject;
$this->attribute = $attribute; $this->attribute = $attribute;
$this->token = $token; $this->token = $token;
} }
public function getTask(): AbstractTask public function getSubject()
{ {
return $this->task; return $this->subject;
} }
public function getAttribute() public function getAttribute()