diff --git a/.github/user_bug_report.md b/.github/user_bug_report.md index 9e5f2a5..4b92a8e 100755 --- a/.github/user_bug_report.md +++ b/.github/user_bug_report.md @@ -8,9 +8,11 @@ assignees: '' --- # Bug Description + A clear and concise description of what the bug is. # How to Reproduce + Steps to reproduce the behavior: 1. Go to '...' @@ -19,16 +21,20 @@ Steps to reproduce the behavior: 4. See error # Expected Behavior + A clear and concise description of what you expected to happen. # Screenshots + If applicable, add screenshots to help explain your problem. # System Information - - System: [e.g. PC or iPhone11, ...] - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - KarakaVersion [e.g. 22] + +- System: [e.g. PC or iPhone11, ...] +- OS: [e.g. iOS] +- Browser [e.g. chrome, safari] +- KarakaVersion [e.g. 22] # Additional Information + Add any other context about the problem here. diff --git a/Admin/Install/Admin.install.json b/Admin/Install/Admin.install.json new file mode 100644 index 0000000..547a03c --- /dev/null +++ b/Admin/Install/Admin.install.json @@ -0,0 +1,9 @@ +[ + { + "type": "setting", + "name": "1007500001", + "content": "#ff000000;#ff00ff00;#ffffffff", + "pattern": "/(#[a-fA-F0-9]{8};)*(#[a-fA-F0-9]{8})/", + "module": "Tag" + } +] \ No newline at end of file diff --git a/Admin/Install/Admin.php b/Admin/Install/Admin.php new file mode 100644 index 0000000..f5cbdfa --- /dev/null +++ b/Admin/Install/Admin.php @@ -0,0 +1,43 @@ + __DIR__ . '/Admin.install.json']); + } +} diff --git a/Admin/Installer.php b/Admin/Installer.php index ddf411f..fa5eb54 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -45,21 +45,5 @@ final class Installer extends InstallerAbstract public static function install(ApplicationAbstract $app, ModuleInfo $info, SettingsInterface $cfgHandler) : void { parent::install($app, $info, $cfgHandler); - - self::installDefaultColors(); - } - - /** - * Installing default tag colors - * - * @return void - */ - private static function installDefaultColors() : void - { - // @todo: move to Admin.install.json file where it belongs and make this module providing for Admin - $setting = new Setting(); - SettingMapper::create()->execute( - $setting->with(0, '1007500001', '#ff000000;#ff00ff00;#ffffffff', '/(#[a-fA-F0-9]{8};)*(#[a-fA-F0-9]{8})/', module: 'Tag') - ); } } diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 473a7bf..358f8e6 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -47,8 +47,8 @@ final class ApiController extends Controller private function validateTagCreate(RequestAbstract $request) : array { $val = []; - if (($val['title'] = empty($request->getData('title'))) - || ($val['color'] = (!empty($request->getData('color')) + if (($val['title'] = !$request->hasData('title')) + || ($val['color'] = ($request->hasData('color') && (!\ctype_xdigit(\ltrim((string) $request->getData('color'), '#')) || \stripos((string) $request->getData('color'), '#') !== 0))) ) { @@ -141,8 +141,8 @@ final class ApiController extends Controller private function validateTagL11nCreate(RequestAbstract $request) : array { $val = []; - if (($val['title'] = empty($request->getData('title'))) - || ($val['tag'] = empty($request->getData('tag'))) + if (($val['title'] = !$request->hasData('title')) + || ($val['tag'] = !$request->hasData('tag')) ) { return $val; } diff --git a/info.json b/info.json index 2e8b158..af7de95 100755 --- a/info.json +++ b/info.json @@ -21,6 +21,7 @@ "Home": "1.0.0" }, "providing": { + "Admin": "*", "Navigation": "*" }, "load": [ diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index 3d6d9dc..a2aac74 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -65,7 +65,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase $permission = new AccountPermission(); $permission->setUnit(1); - $permission->setApp('backend'); + $permission->setApp(2); $permission->setPermission( PermissionType::READ | PermissionType::CREATE