/
[development sugar] Simplify kDBEventHandler::CheckPermission method usage
[development sugar] Simplify kDBEventHandler::CheckPermission method usage
Method kDBEventHandler::CheckPermission
is called to check if a user has a rights to run an event supplied from Front-End. Right now to ensure correct behavior while performing custom permission checks a developer is forced to use this construct each time:
$perm_helper = $this->Application->recallObject('PermissionsHelper'); /* @var $perm_helper kPermissionsHelper */ return $perm_helper->finalizePermissionCheck($event, false);
I think instead we can simply check if kDBEventHandler::CheckPermission method returned false and call this construct automatically from kRequestManager::runEvent
method.
Solution
- in "kEventHandler::CheckPermission" method (including descendant classes) just return true/false instead of calling "kPermissionsHelper::finalizePermissionCheck" method
- in "kRequestManager::runEvent" method check if calling "kEventHandler::CheckPermission" resulted in false and if so run "kPermissionsHelper::finalizePermissionCheck" method to ensure, that all redirect parameters are set properly (e.g. next template, etc.)