add privacyEvent for edit and update singleTask

This commit is contained in:
Mat 2018-10-23 10:42:23 +02:00
parent 508e8ae7fb
commit 9c51d673f0
2 changed files with 17 additions and 2 deletions

View File

@ -12,4 +12,5 @@ PrivacyEvent branch
=================== ===================
- add privacy events to task show / list; - add privacy events to task show / list;
- add privacy events to task edit / update;

View File

@ -156,7 +156,7 @@ class SingleTaskController extends Controller
$event = new PrivacyEvent($person, array( $event = new PrivacyEvent($person, array(
'element_class' => SingleTask::class, 'element_class' => SingleTask::class,
'element_id' => intval($id), 'element_id' => $task->getId(),
'action' => 'show' 'action' => 'show'
)); ));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
@ -225,6 +225,13 @@ class SingleTaskController extends Controller
$this->addFlash('success', $translator $this->addFlash('success', $translator
->trans("The task has been updated")); ->trans("The task has been updated"));
$event = new PrivacyEvent($person, array(
'element_class' => SingleTask::class,
'element_id' => $task->getId(),
'action' => 'update'
));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
return $this->redirectToRoute( return $this->redirectToRoute(
'chill_task_singletask_list', 'chill_task_singletask_list',
$request->query->get('list_params', []) $request->query->get('list_params', [])
@ -241,6 +248,13 @@ class SingleTaskController extends Controller
return $event->getResponse(); return $event->getResponse();
} }
$event = new PrivacyEvent($person, array(
'element_class' => SingleTask::class,
'element_id' => $task->getId(),
'action' => 'edit'
));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
return $this->render('ChillTaskBundle:SingleTask:edit.html.twig', array( return $this->render('ChillTaskBundle:SingleTask:edit.html.twig', array(
'task' => $task, 'task' => $task,
'form' => $form->createView() 'form' => $form->createView()