From f9c081ff263d5ad925bd83f42e521853101e23f0 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Mon, 20 May 2024 18:56:07 +0000 Subject: [PATCH] - Worked on skeleton update --- skeleton/composer.json.dist | 152 +++++++++++++++++++++++++ skeleton/meta/definitions/env.php | 3 + skeleton/meta/definitions/security.php | 22 +++- skeleton/public/.htaccess | 10 +- skeleton/public/index.php | 4 +- skeleton/public/web.config | 45 -------- 6 files changed, 183 insertions(+), 53 deletions(-) create mode 100644 skeleton/composer.json.dist create mode 100644 skeleton/meta/definitions/env.php delete mode 100644 skeleton/public/web.config 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 @@ + 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..ff69dbe 100644 --- a/skeleton/public/.htaccess +++ b/skeleton/public/.htaccess @@ -1,12 +1,18 @@ RewriteEngine On + # RewriteBase / # Force HTTPS (disabled by default) # RewriteCond %{HTTPS} off # RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # Remove trailing slashes from request URL + #RewriteCond %{REQUEST_FILENAME} !-d + #RewriteCond %{REQUEST_URI} (.+)/$ + #RewriteRule ^ %1 [R=301,L] + + # Redirect everything into app + RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d - RewriteCond %{REQUEST_URI} (.+)/$ - RewriteRule ^ %1 [R=301,L] + RewriteRule ^([^?]*)$ %1 [NC,L,QSA] diff --git a/skeleton/public/index.php b/skeleton/public/index.php index 52f18c1..2741b00 100644 --- a/skeleton/public/index.php +++ b/skeleton/public/index.php @@ -1,8 +1,8 @@ getMessage(); + echo sprintf("%s in %s
%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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -