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/Controller/ApiController.php b/Controller/ApiController.php index dfce3f6..b471e31 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -73,7 +73,7 @@ final class ApiController extends Controller private function validateNavElementCreate(RequestAbstract $request) : array { $val = []; - if (($val['name'] = empty($request->getData('name')))) { + if (($val['name'] = !$request->hasData('name'))) { return $val; } diff --git a/Controller/BackendController.php b/Controller/BackendController.php index f090997..5fab161 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -55,7 +55,7 @@ final class BackendController extends Controller $this->app->accountManager->get($request->header->account), $this->app->dbPool, $this->app->unitId, - $this->app->appName + $this->app->appId ); $navView = new NavigationView($this->app->l11nManager, $request, $response); @@ -84,7 +84,7 @@ final class BackendController extends Controller $this->app->accountManager->get($request->header->account), $this->app->dbPool, $this->app->unitId, - $this->app->appName + $this->app->appId ); $nav = new NavigationView($this->app->l11nManager, $request, $response); @@ -150,7 +150,7 @@ final class BackendController extends Controller $this->app->accountManager->get($request->header->account), $this->app->dbPool, $this->app->unitId, - $this->app->appName + $this->app->appId ); $navView = new NavigationView($this->app->l11nManager, $request, $response); diff --git a/Models/Navigation.php b/Models/Navigation.php index a313875..380317e 100755 --- a/Models/Navigation.php +++ b/Models/Navigation.php @@ -62,14 +62,14 @@ class Navigation * @param Account $account Account * @param DatabasePool $dbPool Database pool * @param int $unit Unit - * @param string $appName App name + * @param int $appId App id * * @since 1.0.0 */ - private function __construct(RequestAbstract $request, Account $account, DatabasePool $dbPool, int $unit, string $appName) + private function __construct(RequestAbstract $request, Account $account, DatabasePool $dbPool, int $unit, int $appId) { $this->dbPool = $dbPool; - $this->load($request->getHash(), $account, $unit, $appName); + $this->load($request->getHash(), $account, $unit, $appId); } /** @@ -78,13 +78,13 @@ class Navigation * @param string[] $hashes Request hashes * @param Account $account Account * @param int $unit Unit - * @param string $app App name + * @param int $app App name * * @return void * * @since 1.0.0 */ - private function load(array $hashes, Account $account, int $unit, string $app) : void + private function load(array $hashes, Account $account, int $unit, int $app) : void { if (empty($this->nav)) { $this->nav = []; @@ -161,7 +161,7 @@ class Navigation * @param Account $account Account * @param DatabasePool $dbPool Database pool * @param int $unit Unit - * @param string $appName App name + * @param int $appId App name * * @return \Modules\Navigation\Models\Navigation * @@ -169,14 +169,14 @@ class Navigation * * @since 1.0.0 */ - public static function getInstance(RequestAbstract $hashes = null, Account $account, DatabasePool $dbPool, int $unit, string $appName) + public static function getInstance(RequestAbstract $hashes = null, Account $account, DatabasePool $dbPool, int $unit, int $appId) { if (!isset(self::$instance)) { if (!isset($hashes)) { throw new \Exception('Invalid parameters'); } - self::$instance = new self($hashes, $account, $dbPool, $unit, $appName); + self::$instance = new self($hashes, $account, $dbPool, $unit, $appId); } return self::$instance; diff --git a/tests/Controller/SearchControllerTest.php b/tests/Controller/SearchControllerTest.php index 380049a..3c10ebb 100755 --- a/tests/Controller/SearchControllerTest.php +++ b/tests/Controller/SearchControllerTest.php @@ -72,7 +72,7 @@ final class SearchControllerTest extends \PHPUnit\Framework\TestCase $permission = new AccountPermission(); $permission->setUnit(1); - $permission->setApp('backend'); + $permission->setApp(2); $permission->setPermission( PermissionType::READ | PermissionType::CREATE