diff --git a/composer.json b/composer.json index 8316d52..645d93c 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "mcnd/lean", - "description": "A more-than-micro framework for basic apps", + "description": "A micro framework for rapid application development (RAD)", "type": "library", "license": "MIT", "authors": [ @@ -134,5 +134,29 @@ "post-update-cmd": [ "Lean\\Composer::postUpdate" ] + }, + "extra" : { + "lean" : { + "autoload": { + "definitions" : [ + "meta/definitions/software.php", + "meta/definitions/authorize.php", + "meta/definitions/cli.php", + "meta/definitions/cronard.php", + "meta/definitions/email.php", + "meta/definitions/event.php", + "meta/definitions/http.php", + "meta/definitions/language.php", + "meta/definitions/negundo.php", + "meta/definitions/routes.php", + "meta/definitions/software.php", + "meta/definitions/storage.php", + "meta/definitions/template.php", + ], + "config": [ + "meta/config.php" + ] + } + } } } diff --git a/meta/config.php b/meta/config.php new file mode 100644 index 0000000..d1e8b59 --- /dev/null +++ b/meta/config.php @@ -0,0 +1,14 @@ + [ + 'connections' => [ + 'sqlite' => [ + 'adapter' => 'SQLite', + 'path' => getenv('PROJECT_PATH') . DIRECTORY_SEPARATOR . "var/lean.sqlite3", + 'pragma_begin' => "journal_mode=WAL", + 'pragma_close' => "analysis_limit=500,optimize", + ], + ], + ], +]; \ No newline at end of file diff --git a/meta/definitions/software.php b/meta/definitions/software.php index 56bbc16..ebb1344 100644 --- a/meta/definitions/software.php +++ b/meta/definitions/software.php @@ -1,5 +1,6 @@ [], 'cronard' => [], + + 'taxus' => [ + [ 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" ], + ] ], Lean::class => autowire(Lean::class), diff --git a/meta/definitions/storage.php b/meta/definitions/storage.php new file mode 100644 index 0000000..329a014 --- /dev/null +++ b/meta/definitions/storage.php @@ -0,0 +1,19 @@ + function($c) { + $adapter = new ConnectionAdapter('sqlite', $c->get('config')['ulmus'], true); + $adapter->resolveConfiguration(); + + return $adapter; + } +]; diff --git a/src/Lean.php b/src/Lean.php index a2d62d8..eecad36 100644 --- a/src/Lean.php +++ b/src/Lean.php @@ -93,6 +93,11 @@ class Lean return array_merge(...array_map(fn($app) => $app->events ?? [], $this->applications)); } + public function getTaxusPrivileges() : array + { + return array_merge(...array_map(fn($app) => $app->taxus ?? [], $this->applications)); + } + public function getEntities() : array { return array_merge(...array_map(fn($app) => $app->entities ?? [], $this->applications)); @@ -152,6 +157,8 @@ class Lean public static function definitions() : array { + return []; + $path = dirname(__DIR__) . "/meta/definitions/"; return array_replace( @@ -164,8 +171,8 @@ class Lean require($path . "language.php"), class_exists(\Negundo\Client\NegundoMiddleware::class) ? require($path . "negundo.php") : [], require($path . "routes.php"), - # require($path . "security.php"), require($path . "software.php"), + require($path . "storage.php"), class_exists(\Picea\Picea::class) ? require($path . "template.php") : [], ); }