mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 18:43:49 +00:00
init PrivacyEvent logger service
This commit is contained in:
@@ -22,10 +22,12 @@
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Form\PersonType;
|
||||
use Chill\PersonBundle\Form\CreationPersonType;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
@@ -48,12 +50,20 @@ class PersonController extends Controller
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
|
||||
/**
|
||||
* @var EventDispatcherInterface
|
||||
*/
|
||||
protected $eventDispatcher;
|
||||
|
||||
public function __construct(
|
||||
SimilarPersonMatcher $similarPersonMatcher,
|
||||
TranslatorInterface $translator
|
||||
TranslatorInterface $translator,
|
||||
EventDispatcherInterface $eventDispatcher
|
||||
) {
|
||||
$this->similarPersonMatcher = $similarPersonMatcher;
|
||||
$this->translator = $translator;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
|
||||
public function getCFGroup()
|
||||
@@ -79,10 +89,13 @@ class PersonController extends Controller
|
||||
throw $this->createNotFoundException("Person with id $person_id not"
|
||||
. " found on this server");
|
||||
}
|
||||
|
||||
|
||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person,
|
||||
"You are not allowed to see this person.");
|
||||
|
||||
|
||||
$event = new PrivacyEvent($person);
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
|
||||
return $this->render('ChillPersonBundle:Person:view.html.twig',
|
||||
array("person" => $person,
|
||||
"cFGroup" => $this->getCFGroup()));
|
||||
|
Reference in New Issue
Block a user