fixed: do not allow to edit a course through the "warning" button on the course's index page

This commit is contained in:
Julien Fastré 2022-07-11 13:45:52 +02:00
parent 87a9d48bdf
commit 16fed67dd0
3 changed files with 6 additions and 2 deletions

View File

@ -177,7 +177,7 @@ class AccompanyingCourseController extends Controller
*/ */
public function editAction(AccompanyingPeriod $accompanyingCourse): Response public function editAction(AccompanyingPeriod $accompanyingCourse): Response
{ {
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $accompanyingCourse); $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $accompanyingCourse);
return $this->render('@ChillPerson/AccompanyingCourse/edit.html.twig', [ return $this->render('@ChillPerson/AccompanyingCourse/edit.html.twig', [
'accompanyingCourse' => $accompanyingCourse, 'accompanyingCourse' => $accompanyingCourse,

View File

@ -1,7 +1,7 @@
<div class="alert alert-warning alert-with-actions"> <div class="alert alert-warning alert-with-actions">
<div class="float-button bottom"> <div class="float-button bottom">
<div class="box"> <div class="box">
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_UPDATE', accompanyingCourse) %}
<div class="action"> <div class="action">
<ul class="record_actions"> <ul class="record_actions">
<li> <li>
@ -13,6 +13,8 @@
</li> </li>
</ul> </ul>
</div> </div>
{% endif %}
<p>{{ 'Some peoples does not belong to any household currently. Add them to an household soon'|trans }}</p> <p>{{ 'Some peoples does not belong to any household currently. Add them to an household soon'|trans }}</p>
</div> </div>
</div> </div>

View File

@ -3,6 +3,7 @@
<div class="alert alert-danger {% if hasPersonLocation %}alert-with-actions{% endif %}"> <div class="alert alert-danger {% if hasPersonLocation %}alert-with-actions{% endif %}">
<div class="float-button bottom"> <div class="float-button bottom">
<div class="box"> <div class="box">
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_UPDATE', accompanyingCourse) %}
<div class="action"> <div class="action">
<ul class="record_actions"> <ul class="record_actions">
<li> <li>
@ -14,6 +15,7 @@
</li> </li>
</ul> </ul>
</div> </div>
{% endif %}
<p> <p>
{{ 'This course is located at a temporarily address. You should locate this course to an user'|trans }}</p> {{ 'This course is located at a temporarily address. You should locate this course to an user'|trans }}</p>
{% if not hasPersonLocation %} {% if not hasPersonLocation %}