set ACL only if page is shown

This commit is contained in:
Julien Fastré 2018-07-17 11:34:37 +02:00
parent 59807c2d17
commit d8c3cc4c84

View File

@ -84,10 +84,6 @@ class TaskController extends Controller
return $t->getName() === $transition;
}
))[0];
// we simply check that the user can see the task. Other ACL checks
// should be performed using `guard` events.
$this->denyAccessUnlessGranted(TaskVoter::SHOW, $task);
$form = $this->createTransitionForm($task);
@ -118,6 +114,10 @@ class TaskController extends Controller
if ($event->hasResponse()) {
return $event->getResponse();
} else {
// we simply check that the user can see the task. Other ACL checks
// should be performed using `guard` events.
$this->denyAccessUnlessGranted(TaskVoter::SHOW, $task);
return $this->render($defaultTemplate, [
'task' => $task,
'form' => $form->createView(),