This commit is contained in:
Dave Mc Nicoll 2023-02-08 16:36:57 +00:00
commit 946281c884
6 changed files with 33 additions and 13 deletions

View File

@ -72,7 +72,7 @@ return [
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
return new Zend\Diactoros\Response\HtmlResponse($this->picea->renderHtml("lean/error/404", [], $this), 404);
return new Laminas\Diactoros\Response\HtmlResponse($this->picea->renderHtml("lean/error/404", [], $this), 404);
}
};

View File

@ -0,0 +1,22 @@
<?php
use function DI\autowire, DI\create, DI\get;
use Storage\Session;
use Taxus\{ Privilege, Taxus, PermissionGrantInterface, DefaultPermissionGrant };
use Psr\Http\Message\ServerRequestInterface;
return [
Taxus::class => function ($c) {
return ( new Taxus( $c->get(PermissionGrantInterface::class) ) )->add(
[ new Privilege("dev", "Is a developper of this application."), "is_dev" ],
[ new Privilege("admin", "Can manage mostly everything from this application."), "is_admin" ],
[ new Privilege("user", "Is an authenticated user."), "is_user" ],
[ new Privilege("anonymous", "Is an anonymous (unauthenticated) user."), "is_anonymous" ],
);
},
PermissionGrantInterface::class => create(DefaultPermissionGrant::class)->constructor(get(ServerRequestInterface::class), get(Session::class)),
];

View File

@ -2,7 +2,7 @@
use function DI\autowire, DI\create, DI\get;
use Zend\Diactoros\Response\HtmlResponse;
use Laminas\Diactoros\Response\HtmlResponse;
use TheBugs\JavascriptMiddleware;

View File

@ -2,7 +2,7 @@
use function DI\autowire, DI\create, DI\get;
use Zend\Diactoros\Response\HtmlResponse;
use Laminas\Diactoros\Response\HtmlResponse;
use Picea\{ Picea, Caching\Cache, Caching\Opcache, Compiler, Compiler\Context, Compiler\BaseContext, FileFetcher, Language\DefaultRegistrations, Method\Request };
use Picea\Extension\{ LanguageHandler, LanguageExtension, TitleExtension, MoneyExtension, UrlExtension };

View File

@ -3,6 +3,7 @@
namespace Lean;
use Composer\EventDispatcher\Event;
use Kash\CacheInvalidator;
class Composer
{
@ -48,6 +49,8 @@ class Composer
rmdir($dest);
$event->getIO()->write("Installation completed.");
static::postUpdate($event);
}
else {
$event->getIO()->writeError(sprintf("The user you are running this script with doesn't seem to have a writable permission on directory %s", static::createPath()));
@ -61,9 +64,10 @@ class Composer
$path = static::createPath('var/cache/version.cache');
if ( file_exists($path) ) {
$event->getIO()->write("removing cache file version to force a '$path'");
unlink($path);
if ( is_writeable(dirname($path)) ) {
$event->getIO()->write("regenerating cache file version to invalidate cache for path '$path'");
new CacheInvalidator($path, true);
}
}

View File

@ -80,17 +80,11 @@ class Routing {
$container, $route, $annotation
) : ResponseInterface
{
$class = $annotation->class;
$class = $annotation->class;
$method = $annotation->classMethod;
# $container->set($class, autowire($class)->method($method, $request));
/*if ( null !== ( $languageAnnotation = $this->language->verify($class) ) ) {
if ( $languageAnnotation->key ) {
# TODO !!! $language
}
}*/
$object = $container->get($class);
# Checking if user needs to be logged