diff --git a/src/Bundle/ChillPersonBundle/Controller/ApiPersonController.php b/src/Bundle/ChillPersonBundle/Controller/ApiPersonController.php
deleted file mode 100644
index bfaf22d7b..000000000
--- a/src/Bundle/ChillPersonBundle/Controller/ApiPersonController.php
+++ /dev/null
@@ -1,30 +0,0 @@
-
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-namespace Chill\PersonBundle\Controller;
-
-use Symfony\Bundle\FrameworkBundle\Controller\Controller;
-use Symfony\Component\HttpFoundation\JsonResponse;
-
-
-class ApiPersonController extends Controller
-{
- public function viewAction($id, $_format)
- {
-
- }
-}
diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php
new file mode 100644
index 000000000..84f1ebf66
--- /dev/null
+++ b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php
@@ -0,0 +1,50 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+namespace Chill\PersonBundle\Controller;
+
+use Chill\PersonBundle\Security\Authorization\PersonVoter;
+use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
+use Symfony\Component\Security\Core\Role\Role;
+use Chill\MainBundle\CRUD\Controller\ApiController;
+use Symfony\Component\HttpFoundation\Request;
+
+
+class PersonApiController extends ApiController
+{
+ private AuthorizationHelper $authorizationHelper;
+
+ /**
+ * @param AuthorizationHelper $authorizationHelper
+ */
+ public function __construct(AuthorizationHelper $authorizationHelper)
+ {
+ $this->authorizationHelper = $authorizationHelper;
+ }
+
+ protected function createEntity(string $action, Request $request): object
+ {
+ $person = 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]);
+
+ return $person;
+ }
+}
diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php
index 1112cdfcd..27721012d 100644
--- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php
+++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php
@@ -497,6 +497,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
'name' => 'person',
'base_path' => '/api/1.0/person/person',
'base_role' => \Chill\PersonBundle\Security\Authorization\PersonVoter::SEE,
+ 'controller' => \Chill\PersonBundle\Controller\PersonApiController::class,
'actions' => [
'_entity' => [
'methods' => [
diff --git a/src/Bundle/ChillPersonBundle/config/services/controller.yaml b/src/Bundle/ChillPersonBundle/config/services/controller.yaml
index fd5e1f952..311950883 100644
--- a/src/Bundle/ChillPersonBundle/config/services/controller.yaml
+++ b/src/Bundle/ChillPersonBundle/config/services/controller.yaml
@@ -53,3 +53,9 @@ services:
$validator: '@Symfony\Component\Validator\Validator\ValidatorInterface'
$registry: '@Symfony\Component\Workflow\Registry'
tags: ['controller.service_arguments']
+
+ Chill\PersonBundle\Controller\PersonApiController:
+ arguments:
+ $authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
+ tags: ['controller.service_arguments']
+