diff --git a/composer.json b/composer.json
index 5772d7d..3383551 100644
--- a/composer.json
+++ b/composer.json
@@ -87,6 +87,7 @@
"meta/definitions/email.php",
"meta/definitions/event.php",
"meta/definitions/http.php",
+ "meta/definitions/orm.php",
"meta/definitions/language.php",
"meta/definitions/routes.php",
"meta/definitions/software.php",
diff --git a/meta/definitions/event.php b/meta/definitions/event.php
index db5801a..e6c52e0 100644
--- a/meta/definitions/event.php
+++ b/meta/definitions/event.php
@@ -35,7 +35,7 @@ return [
public function execute(Routing $routing, Route $attribute) : void
{
if (null !== ($name = $attribute->name ?? null)) {
- $this->extension->registerRoute($name, $attribute->getRoute(), $attribute->class, $attribute->classMethod, $attribute->methods ?? (array)$attribute->method);
+ $this->extension->registerRoute($name, $attribute->getRoute(), $attribute->class, $attribute->classMethod, (array) ( $attribute->method ?? $attribute->methods ));
}
}
},
diff --git a/meta/definitions/language.php b/meta/definitions/language.php
index 910580d..07afe90 100644
--- a/meta/definitions/language.php
+++ b/meta/definitions/language.php
@@ -1,29 +1,37 @@
create( Tell\I18n::class ) ->constructor(
- get(Tell\Reader\JsonReader::class),
- get(Tell\Reader\PhpReader::class),
- get('tell.fallback') /* getenv("DEBUG") ? create(Tell\PrintMissingKey::class) : get('tell.fallback') */
- ),
+use function DI\autowire, DI\create, DI\get, DI\add;
- 'tell.fallback' => function($c) {
- $i18n = new Tell\I18n( $c->get(Tell\Reader\JsonReader::class), $c->get(Tell\Reader\PhpReader::class), new Tell\PrintMissingKey() );
+return [
+ I18n::class => function(ContainerInterface $container) {
+ $i18n = new I18n($container->get(Tell\Reader\JsonReader::class), $container->get(Tell\Reader\PhpReader::class), $container->get('tell.fallback'));
+ $i18n->locale(getenv('DEFAULT_LOCAL'));
+ $i18n->initialize(! getenv("DEBUG"));
+
+ return $i18n;
+ },
+
+ 'tell.fallback' => function(ContainerInterface $container) {
+ $i18n = new Tell\I18n( $container->get(Tell\Reader\JsonReader::class), $container->get(Tell\Reader\PhpReader::class), new Tell\PrintMissingKey() );
$i18n->locale(getenv('DEFAULT_LOCAL_FALLBACK') ?: "en_US");
$i18n->initialize(true);
return $i18n;
},
- Tell\Reader\PhpReader::class => function($c) {
- return new Tell\Reader\PhpReader($c->get(Lean\Lean::class)->getI18n('php'), false);
+ Tell\Reader\PhpReader::class => function(ContainerInterface $container) {
+ return new Tell\Reader\PhpReader($container->get(Lean\Lean::class)->getI18n('php'), false);
},
- Tell\Reader\JsonReader::class => function($c) {
- return new Tell\Reader\JsonReader($c->get(Lean\Lean::class)->getI18n('json'), true, \JSON_PRETTY_PRINT);
+ Tell\Reader\JsonReader::class => function(ContainerInterface $container) {
+ return new Tell\Reader\JsonReader($container->get(Lean\Lean::class)->getI18n('json'), true, \JSON_PRETTY_PRINT);
},
+
+ 'lean.autoload' => add([
+ I18n::class,
+ ]),
];
diff --git a/meta/definitions/orm.php b/meta/definitions/orm.php
new file mode 100644
index 0000000..57fac3a
--- /dev/null
+++ b/meta/definitions/orm.php
@@ -0,0 +1,18 @@
+ add([
+ AdapterProxy::class,
+ ]),
+
+ AdapterProxy::class => function (ContainerInterface $c) {
+ return new AdapterProxy(
+ $c->get('lean:adapter.sqlite'),
+ $c->get(ConnectionAdapter::class),
+ );
+ },
+];
diff --git a/meta/definitions/routes.php b/meta/definitions/routes.php
index e8bfc8b..09b022d 100644
--- a/meta/definitions/routes.php
+++ b/meta/definitions/routes.php
@@ -54,7 +54,7 @@ return [
# PostRequestAuthenticationMiddleware::class,
],
- 'routes.list' => function($c) {
+ Lean\Routing\RouteDefinitionInterface::class => function($c) {
return function (ContainerInterface $container) {
$router = $container->get(Router::class);
diff --git a/meta/definitions/software.php b/meta/definitions/software.php
index 27e71b5..31f329f 100644
--- a/meta/definitions/software.php
+++ b/meta/definitions/software.php
@@ -1,6 +1,6 @@
[
'picea' => [
- 'context' => "Lean\\View",
+ 'context' => \Lean\View::class,
'view' => [
[
@@ -74,6 +76,10 @@ return [
],
],
+ 'lean.autoload' => add([
+ Lean::class,
+ ]),
+
Lean::class => autowire(Lean::class),
JavascriptMiddleware::class => create(JavascriptMiddleware::class),
diff --git a/meta/definitions/storage.php b/meta/definitions/storage.php
index 6020ee7..75c85bf 100644
--- a/meta/definitions/storage.php
+++ b/meta/definitions/storage.php
@@ -1,6 +1,7 @@
function($c) {
diff --git a/skeleton/.gitignore b/skeleton/.gitignore
new file mode 100644
index 0000000..ee780a6
--- /dev/null
+++ b/skeleton/.gitignore
@@ -0,0 +1,8 @@
+.idea
+.env
+composer.lock
+/private/
+/public/static/
+/public/.htaccess
+/vendor/
+/var/
\ No newline at end of file
diff --git a/skeleton/composer.json.dist b/skeleton/composer.json.dist
new file mode 100644
index 0000000..3492572
--- /dev/null
+++ b/skeleton/composer.json.dist
@@ -0,0 +1,152 @@
+{
+ "name": "my_namespace/my_project",
+ "description": "",
+ "type": "app",
+ "license": "MIT",
+ "authors": [
+
+ ],
+ "minimum-stability": "dev",
+ "require": {
+ "php": "^8.2",
+ "ext-apcu": "*",
+ "ext-json": "*",
+ "league/route": "^5.0.0-dev",
+ "laminas/laminas-diactoros": "2.24.x-dev",
+ "laminas/laminas-httphandlerrunner": "2.5.x-dev",
+ "vlucas/phpdotenv": "^3.4@dev",
+ "middlewares/whoops": "dev-master",
+ "ralouphie/getallheaders": "dev-master",
+ "mcnd/dump": "dev-master",
+ "mcnd/storage": "dev-master",
+ "mcnd/event": "dev-master",
+ "mcnd/ulmus": "dev-master",
+ "mcnd/ulmus-api": "dev-master",
+ "mcnd/ulmus-user": "dev-master",
+ "mcnd/picea": "dev-master",
+ "mcnd/picea-ui": "dev-master",
+ "mcnd/picea-asset": "dev-master",
+ "mcnd/cronard": "dev-master",
+ "mcnd/lean-console": "dev-master",
+ "mcnd/kash": "dev-master",
+ "mcnd/taxus": "dev-master",
+ "mcnd/notes": "dev-master",
+ "mcnd/thebugs": "dev-master",
+ "mcnd/negundo-client": "dev-master"
+ },
+ "repositories": [
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/cronard.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/dump.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/storage.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/lean.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/lean-console.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/ulmus.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/ulmus-api.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/ulmus-user.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/ulmus-api-gitea.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/picea.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/storage.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/picea-ui.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/picea-asset.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/notes.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/the-bugs.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/tell.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/taxus.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/dump.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/kash.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/event.git"
+ },
+ {
+ "type": "vcs",
+ "url": "https://git.mcnd.ca/mcndave/negundo-client.git"
+ }
+ ],
+ "autoload": {
+ "psr-4": {
+ "MyProject\\Namespace": "src/"
+ }
+ },
+ "scripts": {
+ "post-install-cmd": [
+ "Lean\\Composer::postInstall"
+ ],
+ "post-update-cmd": [
+ "Lean\\Composer::postUpdate"
+ ]
+ },
+ "extra" : {
+ "lean" : {
+ "autoload": {
+ "definitions" : [
+ "meta/definitions/definitions.php",
+ "meta/definitions/storage.php",
+ "meta/definitions/security.php",
+ "meta/definitions/auth.php",
+ "meta/definitions/env.php"
+ ],
+ "config" : [
+ "meta/config.php"
+ ]
+ }
+ }
+ }
+}
diff --git a/skeleton/meta/definitions/env.php b/skeleton/meta/definitions/env.php
new file mode 100644
index 0000000..c906296
--- /dev/null
+++ b/skeleton/meta/definitions/env.php
@@ -0,0 +1,3 @@
+getMessage());
- return new HtmlResponse($picea->renderHtml('lean/error/500', [
+ return HttpFactory::createHtmlResponse($picea->renderHtml('lean/error/500', [
'title' => "Une erreur s'est produite lors de l'exécution du script.",
'subtitle' => "Êtes-vous connecté avec le bon compte ?",
'message' => $exception->getMessage(),
diff --git a/skeleton/meta/definitions/security.php b/skeleton/meta/definitions/security.php
index 531fff1..ba304e9 100644
--- a/skeleton/meta/definitions/security.php
+++ b/skeleton/meta/definitions/security.php
@@ -6,14 +6,28 @@ use Taxus\{ Privilege, Taxus, PermissionGrantInterface, DefaultPermissionGrant }
use Psr\Http\Message\ServerRequestInterface;
-use function DI\autowire, DI\create, DI\get;
+use function DI\{ create, get, add };
return [
Taxus::class => function ($c) {
- return ( new Taxus( $c->get(PermissionGrantInterface::class) ) )->add(
- $c->get(Lean\Lean::class)->getTaxusPrivileges()
- );
+ $taxus = new Taxus( ... $c->get('taxus.gates') );
+
+ $list = [];
+
+ foreach($c->get(Lean\Lean::class)->getTaxusPrivileges() as $key => $privilege) {
+ foreach($privilege as $name => $description) {
+ $list[] = [ new Privilege($name, $description), $key ];
+ }
+ }
+
+ $taxus->add(... $list);
+
+ return $taxus;
},
+ 'taxus.gates' => add([
+ get(PermissionGrantInterface::class),
+ ]),
+
PermissionGrantInterface::class => create(%NAMESPACE%\PrivilegeGrantAccess::class)->constructor(get(ServerRequestInterface::class), get(Session::class)),
];
diff --git a/skeleton/public/.htaccess b/skeleton/public/.htaccess
index 11311da..83b5381 100644
--- a/skeleton/public/.htaccess
+++ b/skeleton/public/.htaccess
@@ -1,12 +1,22 @@
%s", $t->getMessage(), $t->getFile() . ":" . $t->getLine(), $t->getTraceAsString()); } \ No newline at end of file diff --git a/skeleton/public/web.config b/skeleton/public/web.config deleted file mode 100644 index 4217247..0000000 --- a/skeleton/public/web.config +++ /dev/null @@ -1,45 +0,0 @@ - -