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 c530a3e..9f4b1b3 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -111,9 +111,9 @@ final class ApiController extends Controller private function validateAttributeCreate(RequestAbstract $request) : array { $val = []; - if (($val['type'] = empty($request->getData('type'))) - || ($val['value'] = (empty($request->getData('value')) && empty($request->getData('custom')))) - || ($val['ref'] = empty($request->getData('ref'))) + if (($val['type'] = !$request->hasData('type')) + || ($val['value'] = (!$request->hasData('value') && !$request->hasData('custom'))) + || ($val['ref'] = !$request->hasData('ref')) ) { return $val; } @@ -181,8 +181,8 @@ final class ApiController extends Controller private function validateAttributeTypeL11nCreate(RequestAbstract $request) : array { $val = []; - if (($val['title'] = empty($request->getData('title'))) - || ($val['type'] = empty($request->getData('type'))) + if (($val['title'] = !$request->hasData('title')) + || ($val['type'] = !$request->hasData('type')) ) { return $val; } @@ -252,8 +252,8 @@ final class ApiController extends Controller private function validateAttributeTypeCreate(RequestAbstract $request) : array { $val = []; - if (($val['title'] = empty($request->getData('title'))) - || ($val['name'] = empty($request->getData('name'))) + if (($val['title'] = !$request->hasData('title')) + || ($val['name'] = !$request->hasData('name')) ) { return $val; } @@ -337,8 +337,8 @@ final class ApiController extends Controller private function validateAttributeValueCreate(RequestAbstract $request) : array { $val = []; - if (($val['type'] = empty($request->getData('type'))) - || ($val['value'] = empty($request->getData('value'))) + if (($val['type'] = !$request->hasData('type')) + || ($val['value'] = !$request->hasData('value')) ) { return $val; } @@ -406,8 +406,8 @@ final class ApiController extends Controller private function validateAttributeValueL11nCreate(RequestAbstract $request) : array { $val = []; - if (($val['title'] = empty($request->getData('title'))) - || ($val['value'] = empty($request->getData('value'))) + if (($val['title'] = !$request->hasData('title')) + || ($val['value'] = !$request->hasData('value')) ) { return $val; } diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index 52273b3..73a1ce9 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -61,7 +61,7 @@ final class ControllerTest extends \PHPUnit\Framework\TestCase $permission = new AccountPermission(); $permission->setUnit(1); - $permission->setApp('backend'); + $permission->setApp(2); $permission->setPermission( PermissionType::READ | PermissionType::CREATE