From a4021e98bccc3d5fe529ea0639d9b7657854eee1 Mon Sep 17 00:00:00 2001 From: scriptPilot Date: Sat, 24 Feb 2024 02:06:00 +0100 Subject: [PATCH 1/2] simplify config closes #7 --- src/templates/public/api.php | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/templates/public/api.php b/src/templates/public/api.php index d340de4..d14e7c9 100644 --- a/src/templates/public/api.php +++ b/src/templates/public/api.php @@ -34,31 +34,10 @@ 'middlewares' => 'dbAuth,authorization', 'dbAuth.mode' => 'optional', 'dbAuth.registerUser' => '1', - 'dbAuth.returnedColumns' => 'id,username', - 'authorization.tableHandler' => function ($operation, $tableName) { - // Disallow user table for delete operations - if ($operation === 'delete' && $tableName === 'users') { - return false; - } - // No other table limitation + 'authorization.tableHandler' => function ($operation, $tableName) { + if ($tableName === 'users') return false; return true; - }, - 'authorization.columnHandler' => function ($operation, $tableName, $columnName) { - // Hide user/password column - if (($operation === 'read' || $operation === 'list') && $tableName === 'users' && $columnName === 'password') { - return false; - } - // No other column limitation - return true; - }, - 'authorization.recordHandler' => function ($operation, $tableName) { - // Limit user records to same user - if ($tableName === 'users' && $operation !== 'create') { - return 'filter=id,eq,' . USERID; - } - // No other record limitation - return true; - } + } ]); From 2c3b0139ecf260ba8f44aa9cc8708f5249a64707 Mon Sep 17 00:00:00 2001 From: scriptPilot Date: Sat, 24 Feb 2024 02:06:11 +0100 Subject: [PATCH 2/2] 1.8.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9499108..4734f98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "add-php-backend", - "version": "1.7.1", + "version": "1.8.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "add-php-backend", - "version": "1.7.1", + "version": "1.8.0", "license": "MIT", "dependencies": { "fs-extra": "^11.2.0", diff --git a/package.json b/package.json index 4545932..8bb04b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "add-php-backend", - "version": "1.7.1", + "version": "1.8.0", "description": "", "main": "src/index.js", "bin": "src/index.js",