check acl before showing button for creating activity in person/activity

This commit is contained in:
Julien Fastré 2021-11-24 15:14:06 +00:00
parent 5be3b3f423
commit b81c834b5e
4 changed files with 6 additions and 2 deletions

View File

@ -14,6 +14,8 @@ and this project adheres to
* Use the user.label in accompanying course banner, instead of username;
* fix: show validation message when closing accompanying course;
* [thirdparty] link from modal to thirdparty detail page fixed (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/228)
* [activity] remove the "plus" button in activity list
* [activity] check ACL on activity list in person context
## Test releases

View File

@ -3,7 +3,6 @@
{% if activities|length == 0 %}
<p class="chill-no-data-statement">
{{ "There isn't any activities."|trans }}
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}" class="btn btn-sm btn-create"></a>
</p>
{% else %}

View File

@ -36,12 +36,14 @@
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'person'} %}
{% if is_granted('CHILL_ACTIVITY_CREATE', person) %}
<ul class="record_actions sticky-form-buttons">
<li>
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}"
class="btn btn-create disabled" tabindex="-1" role="button" aria-disabled="true">{{ 'Add a new activity' | trans }}
class="btn btn-create" tabindex="-1" role="button" aria-disabled="true">{{ 'Create'|trans }}
</a>
</li>
</ul>
{% endif %}
{% endblock %}

View File

@ -54,6 +54,7 @@ class PersonHasCenterValidatorTest extends ConstraintValidatorTestCase
]);
$prophecy = $this->prophesize(CenterResolverManagerInterface::class);
$prophecy->resolveCenters(Argument::type(Person::class), Argument::any())->will(function ($args) {
$center = $args[0]->getCenter();