diff --git a/4dev/database/function/edit_access_set_uid.sql b/4dev/database/function/edit_access_set_uid.sql index a6d21e91..d1c27e32 100644 --- a/4dev/database/function/edit_access_set_uid.sql +++ b/4dev/database/function/edit_access_set_uid.sql @@ -25,4 +25,4 @@ BEGIN RETURN NEW; END; $$ - LANGUAGE 'plpgsql'; +LANGUAGE 'plpgsql'; diff --git a/4dev/database/function/edit_group_set_uid.sql b/4dev/database/function/edit_group_set_uid.sql index bcee3b11..2775d166 100755 --- a/4dev/database/function/edit_group_set_uid.sql +++ b/4dev/database/function/edit_group_set_uid.sql @@ -25,4 +25,4 @@ BEGIN RETURN NEW; END; $$ - LANGUAGE 'plpgsql'; +LANGUAGE 'plpgsql'; diff --git a/4dev/tests/CoreLibsACLLoginTest.php b/4dev/tests/CoreLibsACLLoginTest.php index 8b1f39cd..c57528a6 100644 --- a/4dev/tests/CoreLibsACLLoginTest.php +++ b/4dev/tests/CoreLibsACLLoginTest.php @@ -1477,7 +1477,7 @@ final class CoreLibsACLLoginTest extends TestCase ); // - loginGetLoginHTML $this->assertStringContainsString( - '', + '=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -597,7 +370,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17" }, "funding": [ { @@ -605,7 +378,7 @@ "type": "github" } ], - "time": "2022-03-07T09:28:20+00:00" + "time": "2022-08-30T12:24:04+00:00" }, { "name": "phpunit/php-file-iterator", @@ -850,16 +623,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.20", + "version": "9.5.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba" + "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/12bc8879fb65aef2138b26fc633cb1e3620cffba", - "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", + "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", "shasum": "" }, "require": { @@ -874,7 +647,6 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpspec/prophecy": "^1.12.1", "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", @@ -889,13 +661,9 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.0", + "sebastian/type": "^3.1", "sebastian/version": "^3.0.2" }, - "require-dev": { - "ext-pdo": "*", - "phpspec/prophecy-phpunit": "^2.0.1" - }, "suggest": { "ext-soap": "*", "ext-xdebug": "*" @@ -937,7 +705,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.20" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.24" }, "funding": [ { @@ -949,7 +717,7 @@ "type": "github" } ], - "time": "2022-04-01T12:37:26+00:00" + "time": "2022-08-30T07:42:16+00:00" }, { "name": "sebastian/cli-parser", @@ -1808,16 +1576,16 @@ }, { "name": "sebastian/type", - "version": "3.0.0", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" + "reference": "fb44e1cc6e557418387ad815780360057e40753e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb44e1cc6e557418387ad815780360057e40753e", + "reference": "fb44e1cc6e557418387ad815780360057e40753e", "shasum": "" }, "require": { @@ -1829,7 +1597,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1852,7 +1620,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.1.0" }, "funding": [ { @@ -1860,7 +1628,7 @@ "type": "github" } ], - "time": "2022-03-15T09:54:48+00:00" + "time": "2022-08-29T06:55:37+00:00" }, { "name": "sebastian/version", @@ -1915,88 +1683,6 @@ ], "time": "2020-09-28T06:39:44+00:00" }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.25.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "30885182c981ab175d4d034db0f6f469898070ab" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", - "reference": "30885182c981ab175d4d034db0f6f469898070ab", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-10-20T20:35:02+00:00" - }, { "name": "theseer/tokenizer", "version": "1.2.1", @@ -2046,64 +1732,6 @@ } ], "time": "2021-07-28T10:34:58+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.10.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "support": { - "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" - }, - "time": "2021-03-09T10:59:23+00:00" } ], "aliases": [], diff --git a/www/includes/edit_base.php b/www/includes/edit_base.php index b9752834..60e0718d 100644 --- a/www/includes/edit_base.php +++ b/www/includes/edit_base.php @@ -552,6 +552,7 @@ if (is_dir(BASE . CACHE)) { } $smarty->display($EDIT_TEMPLATE, 'editAdmin_' . $smarty->lang, 'editAdmin_' . $smarty->lang); +$form->log->debug('DEBUGEND', '==================================== [Form END]'); // debug output echo $login->log->printErrorMsg(); echo $form->log->printErrorMsg(); diff --git a/www/includes/table_arrays/array_edit_pages.php b/www/includes/table_arrays/array_edit_pages.php index ca6c7704..3198eda6 100644 --- a/www/includes/table_arrays/array_edit_pages.php +++ b/www/includes/table_arrays/array_edit_pages.php @@ -66,8 +66,8 @@ $edit_pages = [ 'int' => 1, 'type' => 'binary', 'element_list' => [ - '1' => 'Yes', - '0' => 'No' + '1' => 'Yes', + '0' => 'No' ], ], 'popup' => [ @@ -76,8 +76,8 @@ $edit_pages = [ 'int' => 1, 'type' => 'binary', 'element_list' => [ - '1' => 'Yes', - '0' => 'No' + '1' => 'Yes', + '0' => 'No' ], ], 'popup_x' => [ @@ -128,12 +128,12 @@ $edit_pages = [ 'name' => 'filename', 'before_value' => 'Filename: ' ], - [ - 'name' => 'online', - 'binary' => ['Yes', 'No'], - 'before_value' => 'Online: ' - ], - [ + [ + 'name' => 'online', + 'binary' => ['Yes', 'No'], + 'before_value' => 'Online: ' + ], + [ 'name' => 'menu', 'binary' => ['Yes', 'No'], 'before_value' => 'Menu: ' diff --git a/www/includes/table_arrays/array_edit_users.php b/www/includes/table_arrays/array_edit_users.php index cbe73790..d311b264 100644 --- a/www/includes/table_arrays/array_edit_users.php +++ b/www/includes/table_arrays/array_edit_users.php @@ -15,7 +15,11 @@ $edit_users = [ 'output_name' => 'Username', 'mandatory' => 1, 'error_check' => 'unique|alphanumericextended', - 'type' => 'text' + 'type' => 'text', + // if not min_edit_acl only read + // if not min_show_acl not visible + 'min_edit_acl' => '100', + 'min_show_acl' => '-1', ], 'password' => [ 'value' => $GLOBALS['password'] ?? '', @@ -30,6 +34,8 @@ $edit_users = [ 'value' => 'NOW()' // value [todo: complex reference ], ], + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], // password date when first insert and password is set, needs special field with connection to password // password reset force interval, if set, user needs to reset password after X time period @@ -41,7 +47,9 @@ $edit_users = [ 'type' => 'text', 'interval' => 1, // interval needs NULL write for empty 'size' => 5, // make it 5 chars long - 'length' => 5 + 'length' => 5, + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'enabled' => [ 'value' => $GLOBALS['enabled'] ?? '', @@ -52,6 +60,8 @@ $edit_users = [ '1' => 'Yes', '0' => 'No' ], + 'min_edit_acl' => '100', + 'min_show_acl' => '-1', ], 'deleted' => [ 'value' => $GLOBALS['deleted'] ?? '', @@ -62,6 +72,8 @@ $edit_users = [ '1' => 'Yes', '0' => 'No' ], + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'strict' => [ 'value' => $GLOBALS['strict'] ?? '', @@ -72,6 +84,8 @@ $edit_users = [ '1' => 'Yes', '0' => 'No' ], + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'locked' => [ 'value' => $GLOBALS['locked'] ?? '', @@ -82,6 +96,8 @@ $edit_users = [ '1' => 'Yes', '0' => 'No' ], + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'admin' => [ 'value' => $GLOBALS['admin'] ?? '', @@ -92,6 +108,8 @@ $edit_users = [ '1' => 'Yes', '0' => 'No' ], + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'debug' => [ 'value' => $GLOBALS['debug'] ?? '', @@ -102,6 +120,8 @@ $edit_users = [ '1' => 'Yes', '0' => 'No' ], + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'db_debug' => [ 'value' => $GLOBALS['db_debug'] ?? '', @@ -112,22 +132,30 @@ $edit_users = [ '1' => 'Yes', '0' => 'No' ], + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'email' => [ 'value' => $GLOBALS['email'] ?? '', 'output_name' => 'E-Mail', 'type' => 'text', - 'error_check' => 'email' + 'error_check' => 'email', + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'last_name' => [ 'value' => $GLOBALS['last_name'] ?? '', 'output_name' => 'Last Name', - 'type' => 'text' + 'type' => 'text', + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'first_name' => [ 'value' => $GLOBALS['first_name'] ?? '', 'output_name' => 'First Name', - 'type' => 'text' + 'type' => 'text', + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'lock_until' => [ 'value' => $GLOBALS['lock_until'] ?? '', @@ -136,6 +164,8 @@ $edit_users = [ 'error_check' => 'datetime', 'sql_read' => 'YYYY-MM-DD HH24:MI', 'datetime' => 1, + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'lock_after' => [ 'value' => $GLOBALS['lock_after'] ?? '', @@ -143,7 +173,8 @@ $edit_users = [ 'type' => 'datetime', 'error_check' => 'datetime', 'sql_read' => 'YYYY-MM-DD HH24:MI', - 'datetime' => 1, + 'datetime' => 1,'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'login_user_id' => [ 'value' => $GLOBALS['login_user_id'] ?? '', @@ -151,19 +182,22 @@ $edit_users = [ 'type' => 'text', 'error_check' => 'unique|custom', 'error_regex' => "/^[A-Za-z0-9]+$/", - 'emptynull' => 1, + 'emptynull' => 1,'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'login_user_id_set_date' => [ 'output_name' => 'loginUserId set date', 'value' => $GLOBALS['login_user_id_set_date'] ?? '', 'type' => 'view', - 'empty' => '-' + 'empty' => '-', + 'min_show_acl' => '100', ], 'login_user_id_last_revalidate' => [ 'output_name' => 'loginUserId last revalidate date', 'value' => $GLOBALS['login_user_id_last_revalidate'] ?? '', 'type' => 'view', - 'empty' => '-' + 'empty' => '-', + 'min_show_acl' => '100', ], 'login_user_id_locked' => [ 'value' => $GLOBALS['login_user_id_locked'] ?? '', @@ -174,6 +208,8 @@ $edit_users = [ '1' => 'Yes', '0' => 'No' ], + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'login_user_id_revalidate_after' => [ 'value' => $GLOBALS['login_user_id_revalidate_after'] ?? '', @@ -182,7 +218,9 @@ $edit_users = [ 'error_check' => 'intervalshort', 'interval' => 1, // interval needs NULL write for empty 'size' => 5, // make it 5 chars long - 'length' => 5 + 'length' => 5, + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'login_user_id_valid_from' => [ 'value' => $GLOBALS['login_user_id_valid_from'] ?? '', @@ -191,6 +229,8 @@ $edit_users = [ 'error_check' => 'datetime', 'sql_read' => 'YYYY-MM-DD HH24:MI', 'datetime' => 1, + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'login_user_id_valid_until' => [ 'value' => $GLOBALS['login_user_id_valid_until'] ?? '', @@ -199,6 +239,8 @@ $edit_users = [ 'error_check' => 'datetime', 'sql_read' => 'YYYY-MM-DD HH24:MI', 'datetime' => 1, + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'edit_language_id' => [ 'value' => $GLOBALS['edit_language_id'] ?? '', @@ -206,14 +248,18 @@ $edit_users = [ 'mandatory' => 1, 'int' => 1, 'type' => 'drop_down_db', - 'query' => "SELECT edit_language_id, long_name FROM edit_language WHERE enabled = 1 ORDER BY order_number" + 'query' => "SELECT edit_language_id, long_name FROM edit_language WHERE enabled = 1 ORDER BY order_number", + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'edit_scheme_id' => [ 'value' => $GLOBALS['edit_scheme_id'] ?? '', 'output_name' => 'Scheme', 'int_null' => 1, 'type' => 'drop_down_db', - 'query' => "SELECT edit_scheme_id, name FROM edit_scheme WHERE enabled = 1 ORDER BY name" + 'query' => "SELECT edit_scheme_id, name FROM edit_scheme WHERE enabled = 1 ORDER BY name", + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'edit_group_id' => [ 'value' => $GLOBALS['edit_group_id'] ?? '', @@ -221,7 +267,9 @@ $edit_users = [ 'int' => 1, 'type' => 'drop_down_db', 'query' => "SELECT edit_group_id, name FROM edit_group WHERE enabled = 1 ORDER BY name", - 'mandatory' => 1 + 'mandatory' => 1, + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'edit_access_right_id' => [ 'value' => $GLOBALS['edit_access_right_id'] ?? '', @@ -229,25 +277,30 @@ $edit_users = [ 'mandatory' => 1, 'int' => 1, 'type' => 'drop_down_db', - 'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level" + 'query' => "SELECT edit_access_right_id, name FROM edit_access_right ORDER BY level", + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'login_error_count' => [ 'output_name' => 'Login error count', 'value' => $GLOBALS['login_error_count'] ?? '', 'type' => 'view', - 'empty' => '0' + 'empty' => '0', + 'min_show_acl' => '100', ], 'login_error_date_last' => [ 'output_name' => 'Last login error', 'value' => $GLOBALS['login_error_date_liast'] ?? '', 'type' => 'view', - 'empty' => '-' + 'empty' => '-', + 'min_show_acl' => '100', ], 'login_error_date_first' => [ 'output_name' => 'First login error', 'value' => $GLOBALS['login_error_date_first'] ?? '', 'type' => 'view', - 'empty' => '-' + 'empty' => '-', + 'min_show_acl' => '100', ], 'protected' => [ 'value' => $GLOBALS['protected'] ?? '', @@ -258,6 +311,8 @@ $edit_users = [ '1' => 'Yes', '0' => 'No' ], + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], 'additional_acl' => [ 'value' => $GLOBALS['additional_acl'] ?? '', @@ -265,12 +320,27 @@ $edit_users = [ 'type' => 'textarea', 'error_check' => 'json', 'rows' => 10, - 'cols' => 60 + 'cols' => 60, + 'min_edit_acl' => '100', + 'min_show_acl' => '100', ], ], 'load_query' => "SELECT edit_user_id, username, enabled, deleted, " . "strict, locked, login_error_count " - . "FROM edit_user ORDER BY username", + . "FROM edit_user " + // if base acl is not 90 only list enabled + // if not admin flag, do not list admin flagged + . ( + !$GLOBALS['acl_admin'] ? + "WHERE admin = 0 " + . ( + $GLOBALS['base_acl_level'] < 90 ? + "AND enabled = 1 " : + "" + ) + : '' + ) + . "ORDER BY username", 'table_name' => 'edit_user', 'show_fields' => [ [ @@ -305,7 +375,12 @@ $edit_users = [ 'edit_access_user' => [ 'output_name' => 'Accounts', 'mandatory' => 1, - 'delete' => 0, // set then reference entries are deleted, else the 'enable' flag is only set + // set then reference entries are deleted, else the 'enable' flag is only set + 'delete' => 0, + // acl + 'min_edit_acl' => '40', + 'min_show_acl' => '20', + // table read prefix 'prefix' => 'ecu', 'read_data' => [ 'table_name' => 'edit_access', diff --git a/www/includes/templates/admin/edit_body.tpl b/www/includes/templates/admin/edit_body.tpl index 926d244d..0486b6a7 100644 --- a/www/includes/templates/admin/edit_body.tpl +++ b/www/includes/templates/admin/edit_body.tpl @@ -83,13 +83,8 @@ function pop(theURL, winName, features) {