Child pages
  • [development sugar] Simplify kDBEventHandler::CheckPermission method usage
Skip to end of metadata
Go to start of metadata

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

  1. in "kEventHandler::CheckPermission" method (including descendant classes) just return true/false instead of calling "kPermissionsHelper::finalizePermissionCheck" method
  2. 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.)

Related Tasks

INP-1327 - Getting issue details... STATUS

2 Comments

  1. I agree, can do this as described. Please create a task for this.

    Can go in Icebox until next release planning.

  2. As part of this we'll be removing any calls to finalizePermissionCheck method within kEventHandler::CheckPermission methods.