Merge remote-tracking branch 'origin/master' into issue230_person

This commit is contained in:
nobohan
2022-01-04 13:50:27 +01:00
611 changed files with 13079 additions and 4316 deletions

View File

@@ -21,7 +21,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Role\Role;
use function array_filter;
use function array_values;
@@ -76,14 +76,6 @@ class PersonApiController extends ApiController
return $this->json(array_values($addresses), Response::HTTP_OK, [], ['groups' => ['read']]);
}
protected function createEntity(string $action, Request $request): object
{
return parent::createEntity($action, $request);
// TODO temporary hack to allow creation of person with fake center
/* $centers = $this->authorizationHelper->getReachableCenters($this->getUser(),
new Role(PersonVoter::CREATE));
$person->setCenter($centers[0]); */
}
/**
* @Route("/api/1.0/person/config/alt_names.{_format}",
@@ -120,17 +112,4 @@ class PersonApiController extends ApiController
return $this->json($configAltNames, Response::HTTP_OK, [], ['groups' => ['read']]);
}
protected function getValidationGroups(string $action, Request $request, string $_format, $entity): ?array
{
if ($action === '_entity'){
if ($request->getMethod() === Request::METHOD_POST){
return ["creation"];
}
if (($request->getMethod() === Request::METHOD_PATCH) || ($request->getMethod() === Request::METHOD_PUT)){
return ["general"];
}
};
return parent::getValidationGroups($action, $request, $_format, $entity);
}
}