From abe94e498f830b6c1bf6cd61346d67fb041cafc0 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Thu, 21 May 2026 15:09:20 +0000 Subject: [PATCH] - Fixed conflicts --- meta/definitions/authorize.php | 19 +++++++++------- src/ApplicationStrategy.php | 35 +++++++++++++++++++++++++++++- view/lean/picto/undraw_error.phtml | 8 ------- 3 files changed, 45 insertions(+), 17 deletions(-) diff --git a/meta/definitions/authorize.php b/meta/definitions/authorize.php index 6d79ba0..6c3fafa 100644 --- a/meta/definitions/authorize.php +++ b/meta/definitions/authorize.php @@ -2,12 +2,14 @@ use Lean\Factory\HttpFactoryInterface; -use Ulmus\User\{ - Authorize\HeaderAuthentication, Authorize\PostRequestAuthentication, +use Ulmus\User\{Authorize\HeaderAuthentication, Entity, - Lib\Authenticate, Lib\Authorize, - Middleware\AuthenticationMiddleware, Middleware\HeaderAuthenticationMiddleware, Middleware\PostRequestAuthenticationMiddleware, -}; + Lib\Authenticate, + Lib\Authorize, + Middleware\AuthenticationMiddleware, + Middleware\HeaderAuthenticationMiddleware, + Middleware\PostRequestAuthenticationMiddleware, + Authorize\PostRequestAuthentication}; use Picea\Picea; use Storage\{ Cookie, Session }; @@ -15,6 +17,7 @@ use Psr\Container\ContainerInterface; use function DI\{get, autowire, create}; + return [ Authorize::class => create(Authorize::class)->constructor(get(Entity\UserInterface::class), get(Session::class), get(Cookie::class), get('authentication.method')), @@ -35,9 +38,9 @@ return [ 'authorize.error' => function(ContainerInterface $c) { return function(array $errorData) use ($c) { return $c->get(HttpFactoryInterface::class)::createJsonResponse($errorData + [ - 'api.error' => "Authorization failed", - 'api.datetime' => (new \DateTime)->format(\DateTime::ATOM), - ], 403); + 'api.error' => "Authorization failed", + 'api.datetime' => (new \DateTime)->format(\DateTime::ATOM), + ], 403); }; }, diff --git a/src/ApplicationStrategy.php b/src/ApplicationStrategy.php index 5ca5196..ea4a7b5 100644 --- a/src/ApplicationStrategy.php +++ b/src/ApplicationStrategy.php @@ -34,9 +34,42 @@ class ApplicationStrategy extends Strategy\ApplicationStrategy { return $this->getContainer()->get(ThrowableHandlerInterface::class); } - + public function getMethodNotAllowedDecorator(MethodNotAllowedException $exception): MiddlewareInterface { return $this->getContainer()->has(MethodNotAllowedInterface::class) ? $this->getContainer()->get(MethodNotAllowedInterface::class) : parent::getMethodNotAllowedDecorator($exception); } + /* +<<<<<<< HEAD + public function getMethodNotAllowedDecorator(MethodNotAllowedException $exception): MiddlewareInterface + { + return $this->getContainer()->has(MethodNotAllowedInterface::class) ? $this->getContainer()->get(MethodNotAllowedInterface::class) : parent::getMethodNotAllowedDecorator($exception); +======= + public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface + { + if (php_sapi_name() !== 'cli' and ! defined('STDIN')) { + return $this->throw404($request); + } + + return $handler->handle($request);; + } + + public function throw404(ServerRequestInterface $request) : ResponseInterface + { + if ( getenv('DEBUG') && $this->di->has(\Picea\Asset\Asset::class) ) { + $params = $request->getServerParams(); + + $scpName = basename(explode('?', $params['REQUEST_URI'] ?? "", 2)[0]); + list(, $ext) = array_pad(explode('.', $scpName), 2, null); + + if ($ext && in_array($ext, ApplicationStrategy::ASSET_TRIGGER_UPDATE)) { + $this->di->get(\Picea\Asset\Asset::class)->launchInstall(); + } + } + + return $this->di->get('error.404'); + } + }; +>>>>>>> af8b686 (- WIP on ulmus-user mechanics updates) + }*/ } \ No newline at end of file diff --git a/view/lean/picto/undraw_error.phtml b/view/lean/picto/undraw_error.phtml index f1e6345..36a976a 100644 --- a/view/lean/picto/undraw_error.phtml +++ b/view/lean/picto/undraw_error.phtml @@ -1,9 +1 @@ -<<<<<<< HEAD -<<<<<<< HEAD bug fixing -======= - ->>>>>>> fdca37a (- Added createStream methods and fixed multiple errors views) -======= - ->>>>>>> fdca37a (- Added createStream methods and fixed multiple errors views)