diff --git a/application/symfony/src/Controller/API/APIControllerInterface.php b/application/symfony/src/Controller/API/APIControllerInterface.php deleted file mode 100644 index 134d247..0000000 --- a/application/symfony/src/Controller/API/APIControllerInterface.php +++ /dev/null @@ -1,19 +0,0 @@ -getUser()) { + //throw $this->createAccessDeniedException('The user must be logged in!'); + } + if (Request::METHOD_POST === $request->getMethod()) { $response = new Response(); $response->setContent('Post Request!'); return $response; } - - $response = new Response(); - $response->setContent('GET Request!'); + /** + * @var SecureSourceCreatorInterface + */ + $sourceCreator = $crudFactory->create(); + $response->setContent($sourceCreator->create()->getText()); return $response; - $requestedSource = new PureSource(); - $requestedSource->setSlug(SystemSlugType::IMPRINT); - $requestedRight = new Right(); - $requestedRight->setSource($requestedSource); - $requestedRight->setLayer(LayerType::SOURCE); - $requestedRight->setType(CRUDType::READ); - $sourceResponseManager = new SourceRESTResponseManager($this->getUser(), $entityManager, $requestedRight, $this->getViewHandler()); +// $response = new Response(); +// $response->setContent('GET Request!'); - return $sourceResponseManager->getResponse(); +// return $response; + +// $requestedSource = new PureSource(); +// $requestedSource->setSlug(SystemSlugType::IMPRINT); +// $requestedRight = new Right(); +// $requestedRight->setSource($requestedSource); +// $requestedRight->setLayer(LayerType::SOURCE); +// $requestedRight->setType(CRUDType::READ); +// $sourceResponseManager = new SourceRESTResponseManager($this->getUser(), $entityManager, $requestedRight, $this->getViewHandler()); + +// return $sourceResponseManager->getResponse(); } /** @@ -67,7 +82,7 @@ class SourceApiController extends AbstractAPIController * ) * {@inheritdoc} * - * @see \App\Controller\API\CRUDControllerInterface::update() + * @see \App\Controller\API\AbstractAPIController::update() */ public function update(Request $request, $identifier): Response { @@ -80,7 +95,7 @@ class SourceApiController extends AbstractAPIController * ) * {@inheritdoc} * - * @see \App\Controller\API\APIControllerInterface::list() + * @see \App\Controller\API\AbstractAPIController::list() */ public function list(Request $request): Response { @@ -93,7 +108,7 @@ class SourceApiController extends AbstractAPIController * ) * {@inheritdoc} * - * @see \App\Controller\API\CRUDControllerInterface::delete() + * @see \App\Controller\API\AbstractAPIController::delete() */ public function delete(Request $request, $identifier): Response { diff --git a/application/symfony/src/Domain/SecureCRUDManagement/AbstractSecureCRUD.php b/application/symfony/src/Domain/SecureCRUDManagement/AbstractSecureCRUD.php new file mode 100644 index 0000000..34a7d61 --- /dev/null +++ b/application/symfony/src/Domain/SecureCRUDManagement/AbstractSecureCRUD.php @@ -0,0 +1,11 @@ +setText('Hello World!'); + + return $source; + } +} diff --git a/application/symfony/src/Domain/SecureCRUDManagement/Create/SecureSourceCreatorInterface.php b/application/symfony/src/Domain/SecureCRUDManagement/Create/SecureSourceCreatorInterface.php new file mode 100644 index 0000000..5166ac7 --- /dev/null +++ b/application/symfony/src/Domain/SecureCRUDManagement/Create/SecureSourceCreatorInterface.php @@ -0,0 +1,11 @@ +request = $requestStack->getCurrentRequest(); + $this->security = $security; + } + + /** + * @param RightInterface $requestedRight + */ + public function create(?RightInterface $requestedRight = null) + { + return new SecureSourceCreator($this->request, $this->security); + } +} diff --git a/application/symfony/src/Domain/SecureCRUDManagement/SecureCRUDInterface.php b/application/symfony/src/Domain/SecureCRUDManagement/SecureCRUDInterface.php new file mode 100644 index 0000000..3f143bd --- /dev/null +++ b/application/symfony/src/Domain/SecureCRUDManagement/SecureCRUDInterface.php @@ -0,0 +1,12 @@ + $url, + ]); + $request->setMethod(Request::METHOD_GET); + $response = static::$kernel->handle($request); + $this->assertEquals(200, $response->getStatusCode()); + } +}