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;
use Symfony\Component\EventDispatcher\Event;
use Chill\TaskBundle\Entity\AbstractTask;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
/**
@ -16,9 +15,9 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
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';
public function __construct(
AbstractTask $task,
$subject,
$attribute,
TokenInterface $token
) {
$this->task = $task;
$this->subject = $subject;
$this->attribute = $attribute;
$this->token = $token;
}
public function getTask(): AbstractTask
public function getSubject()
{
return $this->task;
return $this->subject;
}
public function getAttribute()