Compare commits

...

5 Commits

Author SHA1 Message Date
Dave Mc Nicoll
01d48463b3 - Merged with master done 2026-05-21 15:18:50 +00:00
Dave Mc Nicoll
abe94e498f - Fixed conflicts 2026-05-21 15:18:49 +00:00
Dev
adfd619c5f - Fixed default view order to 1000 2026-05-21 15:18:04 +00:00
16ee06593c - Added createStream methods and fixed multiple errors views 2026-05-21 15:18:03 +00:00
5bb5e8ce61 - Added MethodNotAllowed interface 2026-05-21 15:16:58 +00:00
5 changed files with 53 additions and 23 deletions

View File

@ -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);
};
},

View File

@ -1,15 +1,13 @@
<?php
use Psr\Container\ContainerInterface;
use Lean\ApplicationStrategy\{ ThrowableHandler, ThrowableHandlerInterface, NotFoundDecoratorInterface, NotFoundDecorator, MethodNotAllowedInterface, };
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ServerRequestInterface;
use Laminas\{ Diactoros\ServerRequestFactory, HttpHandlerRunner\Emitter\EmitterInterface, HttpHandlerRunner\Emitter\SapiEmitter };
use Lean\Factory\{ HttpFactory, HttpFactoryInterface };
use Picea\Picea;
use function DI\autowire, DI\create, DI\get;
use function DI\{ autowire, create, get };
return [
ServerRequestInterface::class => function ($c) {
@ -20,6 +18,10 @@ return [
EmitterInterface::class => create(SapiEmitter::class),
ThrowableHandlerInterface::class => autowire(ThrowableHandler::class),
NotFoundDecoratorInterface::class => autowire(NotFoundDecorator::class),
# MethodNotAllowedInterface::class => autowire(MethodNotAllowedDecorator::class),
HttpFactoryInterface::class => create(HttpFactory::class),
'error.401' => function(ContainerInterface $c, Picea $picea) {
@ -32,9 +34,5 @@ return [
'error.500' => function(ContainerInterface $c, Picea $picea) {
return $c->get(HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml("lean/error/500", []), 500);
},
ThrowableHandlerInterface::class => autowire(ThrowableHandler::class),
NotFoundDecoratorInterface::class => autowire(NotFoundDecorator::class),
# MethodNotAllowedInterface::class => autowire(MethodNotAllowedDecorator::class),
}
];

View File

@ -39,4 +39,37 @@ class ApplicationStrategy extends Strategy\ApplicationStrategy {
{
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)
}*/
}

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -10,7 +10,7 @@
{% if $messageList %}
<div class="message-wrapper">{% php
foreach($messageList as $name => $context) {
foreach($context->messages ?? [] as $message) {
foreach($context->formContextMessages ?? [] as $message) {
echo $message->render();
}
}