init PrivacyEvent logger service

This commit is contained in:
Mat
2018-10-16 09:56:36 +02:00
parent b5a9105a0f
commit f5baeaa06c
6 changed files with 241 additions and 3 deletions

View File

@@ -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()));