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 8af6c7b..75fc5e8 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -154,8 +154,8 @@ final class ApiController extends Controller private function validateKanbanCardCreate(RequestAbstract $request) : array { $val = []; - if (($val['title'] = empty($request->getData('title'))) - || ($val['column'] = empty($request->getData('column'))) + if (($val['title'] = !$request->hasData('title')) + || ($val['column'] = !$request->hasData('column')) || ($val['status'] = ( $request->hasData('status') && !CardStatus::isValidValue((int) $request->getData('status')) @@ -245,8 +245,8 @@ final class ApiController extends Controller private function validateKanbanCardCommentCreate(RequestAbstract $request) : array { $val = []; - if (($val['plain'] = empty($request->getData('plain'))) - || ($val['card'] = empty($request->getData('card'))) + if (($val['plain'] = !$request->hasData('plain')) + || ($val['card'] = !$request->hasData('card')) ) { return $val; } @@ -338,7 +338,7 @@ final class ApiController extends Controller private function validateKanbanBoardCreate(RequestAbstract $request) : array { $val = []; - if (($val['title'] = empty($request->getData('title'))) + if (($val['title'] = !$request->hasData('title')) || ($val['status'] = ( $request->hasData('status') && !CardStatus::isValidValue((int) $request->getData('status')) @@ -454,8 +454,8 @@ final class ApiController extends Controller private function validateKanbanColumnCreate(RequestAbstract $request) : array { $val = []; - if (($val['title'] = empty($request->getData('title')) - || ($val['board'] = empty($request->getData('board')))) + if (($val['title'] = !$request->hasData('title') + || ($val['board'] = !$request->hasData('board'))) ) { return $val; } diff --git a/Controller/BackendController.php b/Controller/BackendController.php index b806145..3fe8043 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -118,7 +118,7 @@ final class BackendController extends Controller if ($board->createdBy->getId() !== $accountId && !$this->app->accountManager->get($accountId)->hasPermission( - PermissionType::READ, $this->app->unitId, $this->app->appName, self::NAME, PermissionCategory::BOARD, $board->getId()) + PermissionType::READ, $this->app->unitId, $this->app->appId, self::NAME, PermissionCategory::BOARD, $board->getId()) ) { $view->setTemplate('/Web/Backend/Error/403_inline'); $response->header->status = RequestStatusCode::R_403; @@ -183,7 +183,7 @@ final class BackendController extends Controller $accountId = $request->header->account; if (!$this->app->accountManager->get($accountId)->hasPermission( - PermissionType::CREATE, $this->app->unitId, $this->app->appName, self::NAME, PermissionCategory::BOARD) + PermissionType::CREATE, $this->app->unitId, $this->app->appId, self::NAME, PermissionCategory::BOARD) ) { $view->setTemplate('/Web/Backend/Error/403_inline'); $response->header->status = RequestStatusCode::R_403; @@ -229,7 +229,7 @@ final class BackendController extends Controller if ($card->createdBy->getId() !== $accountId && !$this->app->accountManager->get($accountId)->hasPermission( - PermissionType::READ, $this->app->unitId, $this->app->appName, self::NAME, PermissionCategory::CARD, $card->getId()) + PermissionType::READ, $this->app->unitId, $this->app->appId, self::NAME, PermissionCategory::CARD, $card->getId()) ) { $view->setTemplate('/Web/Backend/Error/403_inline'); $response->header->status = RequestStatusCode::R_403; diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index de3daeb..166acba 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -68,7 +68,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