mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge remote-tracking branch 'origin/master' into feature/add-api-endpoint-for-permission
This commit is contained in:
commit
153576df70
@ -13,6 +13,9 @@ and this project adheres to
|
|||||||
<!-- write down unreleased development here -->
|
<!-- write down unreleased development here -->
|
||||||
* Use the user.label in accompanying course banner, instead of username;
|
* Use the user.label in accompanying course banner, instead of username;
|
||||||
* fix: show validation message when closing accompanying course;
|
* 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
|
## Test releases
|
||||||
|
|
||||||
|
@ -1330,14 +1330,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php
|
path: src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php
|
||||||
|
|
||||||
-
|
|
||||||
message:
|
|
||||||
"""
|
|
||||||
#^Parameter \\$centerResolverDispatcher of method Chill\\\\PersonBundle\\\\Validator\\\\Constraints\\\\Person\\\\PersonHasCenterValidator\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\:
|
|
||||||
Use CenterResolverManager and its interface CenterResolverManagerInterface$#
|
|
||||||
"""
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Validator/Constraints/Person/PersonHasCenterValidator.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message:
|
message:
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
{% if activities|length == 0 %}
|
{% if activities|length == 0 %}
|
||||||
<p class="chill-no-data-statement">
|
<p class="chill-no-data-statement">
|
||||||
{{ "There isn't any activities."|trans }}
|
{{ "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>
|
</p>
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -36,12 +36,14 @@
|
|||||||
|
|
||||||
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'person'} %}
|
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'person'} %}
|
||||||
|
|
||||||
|
{% if is_granted('CHILL_ACTIVITY_CREATE', person) %}
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}"
|
<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>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -189,7 +189,7 @@ export default {
|
|||||||
// TODO i18n
|
// TODO i18n
|
||||||
return `/fr/person/${id}/general`;
|
return `/fr/person/${id}/general`;
|
||||||
} else if (type === 'thirdparty') {
|
} else if (type === 'thirdparty') {
|
||||||
return `/fr/thirdparty/thirdparty/${id}/show`;
|
return `/fr/3party/3party/${id}/view`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,11 @@ declare(strict_types=1);
|
|||||||
namespace Validator\Person;
|
namespace Validator\Person;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\Center;
|
use Chill\MainBundle\Entity\Center;
|
||||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
|
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\PersonBundle\Validator\Constraints\Person\PersonHasCenter;
|
use Chill\PersonBundle\Validator\Constraints\Person\PersonHasCenter;
|
||||||
use Chill\PersonBundle\Validator\Constraints\Person\PersonHasCenterValidator;
|
use Chill\PersonBundle\Validator\Constraints\Person\PersonHasCenterValidator;
|
||||||
|
use Prophecy\Argument;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
||||||
|
|
||||||
@ -52,9 +53,19 @@ class PersonHasCenterValidatorTest extends ConstraintValidatorTestCase
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$centerResolverDispatcher = $this->createMock(CenterResolverDispatcherInterface::class);
|
$prophecy = $this->prophesize(CenterResolverManagerInterface::class);
|
||||||
|
|
||||||
return new PersonHasCenterValidator($parameterBag, $centerResolverDispatcher);
|
$prophecy->resolveCenters(Argument::type(Person::class), Argument::any())->will(function ($args) {
|
||||||
|
$center = $args[0]->getCenter();
|
||||||
|
|
||||||
|
if ($center instanceof Center) {
|
||||||
|
return [$center];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
});
|
||||||
|
|
||||||
|
return new PersonHasCenterValidator($parameterBag, $prophecy->reveal());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getConstraint()
|
protected function getConstraint()
|
||||||
|
@ -11,7 +11,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Validator\Constraints\Person;
|
namespace Chill\PersonBundle\Validator\Constraints\Person;
|
||||||
|
|
||||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
|
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Validator\Constraint;
|
use Symfony\Component\Validator\Constraint;
|
||||||
@ -22,12 +22,12 @@ class PersonHasCenterValidator extends ConstraintValidator
|
|||||||
{
|
{
|
||||||
private bool $centerRequired;
|
private bool $centerRequired;
|
||||||
|
|
||||||
private CenterResolverDispatcherInterface $centerResolverDispatcher;
|
private CenterResolverManagerInterface $centerResolverManager;
|
||||||
|
|
||||||
public function __construct(ParameterBagInterface $parameterBag, CenterResolverDispatcherInterface $centerResolverDispatcher)
|
public function __construct(ParameterBagInterface $parameterBag, CenterResolverManagerInterface $centerResolverManager)
|
||||||
{
|
{
|
||||||
$this->centerRequired = $parameterBag->get('chill_person')['validation']['center_required'];
|
$this->centerRequired = $parameterBag->get('chill_person')['validation']['center_required'];
|
||||||
$this->centerResolverDispatcher = $centerResolverDispatcher;
|
$this->centerResolverManager = $centerResolverManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validate($person, Constraint $constraint)
|
public function validate($person, Constraint $constraint)
|
||||||
@ -40,7 +40,7 @@ class PersonHasCenterValidator extends ConstraintValidator
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $this->centerResolverDispatcher->resolveCenter($person)) {
|
if ([] === $this->centerResolverManager->resolveCenters($person)) {
|
||||||
$this
|
$this
|
||||||
->context
|
->context
|
||||||
->buildViolation($constraint->message)
|
->buildViolation($constraint->message)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user