mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 02:23:51 +00:00
privacyEvent: remove element parameter
This commit is contained in:
@@ -25,6 +25,14 @@ namespace Chill\PersonBundle\Privacy;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
|
||||
/**
|
||||
* Class PrivacyEvent
|
||||
*
|
||||
* Array $args expects arguments with the following keys: 'element_class', 'element_id', 'action'
|
||||
* By default, action is set to 'show'
|
||||
*
|
||||
* @package Chill\PersonBundle\Privacy
|
||||
*/
|
||||
class PrivacyEvent extends Event
|
||||
{
|
||||
const PERSON_PRIVACY_EVENT = 'chill_person.privacy_event';
|
||||
@@ -34,11 +42,6 @@ class PrivacyEvent extends Event
|
||||
*/
|
||||
private $person;
|
||||
|
||||
/**
|
||||
* @var Object
|
||||
*/
|
||||
private $element;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
@@ -53,13 +56,11 @@ class PrivacyEvent extends Event
|
||||
* PrivacyEvent constructor.
|
||||
*
|
||||
* @param Person $person
|
||||
* @param object $element
|
||||
* @param array $args
|
||||
*/
|
||||
public function __construct(Person $person, object $element = null, array $args = array('action' => 'show'))
|
||||
public function __construct(Person $person, array $args = array('action' => 'show'))
|
||||
{
|
||||
$this->person = $person;
|
||||
$this->element = $element;
|
||||
$this->args = $args;
|
||||
$this->persons = array();
|
||||
}
|
||||
@@ -95,15 +96,7 @@ class PrivacyEvent extends Event
|
||||
*/
|
||||
public function hasPersons()
|
||||
{
|
||||
return (count($this->persons) >= 1 ? true : false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Object
|
||||
*/
|
||||
public function getElement()
|
||||
{
|
||||
return $this->element;
|
||||
return count($this->persons) >= 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -69,15 +69,17 @@ class PrivacyEventSubscriber implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
$this->logger->notice("[Privacy Event] A Person Folder has been viewed", array(
|
||||
$involved = array(
|
||||
'by_user' => $this->token->getToken()->getUser()->getUsername(),
|
||||
'by_user_id' => $this->token->getToken()->getUser()->getId(),
|
||||
'person_id' => $event->getPerson()->getId(),
|
||||
'persons' => $persons,
|
||||
'element_class' => $event->getArgs()['element_class'],
|
||||
'element_id' => intval($event->getArgs()['element_id']),
|
||||
'action' => $event->getArgs()['action']
|
||||
));
|
||||
);
|
||||
|
||||
$this->logger->notice(
|
||||
"[Privacy Event] A Person Folder has been viewed",
|
||||
array_merge($involved, $event->getArgs())
|
||||
);
|
||||
|
||||
dump($event);
|
||||
}
|
||||
|
Reference in New Issue
Block a user