Allow custom request checker prior to displaying page
Summary: We want to allow a broader access to our installation but we need to check the request in that case. Test Plan: Created a simple `PhabricatorRequestChecker` returning a custom controller. Verified that this controller is used when accessing any page. Returned `null` from this checker and verified that all 209 Phabricator pages are accessible. Reviewers: epriestley Reviewed By: epriestley CC: scottmac, aran, Korvin, btrahan Differential Revision: https://secure.phabricator.com/D2488
This commit is contained in:
@@ -79,6 +79,19 @@ abstract class PhabricatorController extends AphrontController {
|
||||
return $this->delegateToController($disabled_user_controller);
|
||||
}
|
||||
|
||||
$event = new PhabricatorEvent(
|
||||
PhabricatorEventType::TYPE_CONTROLLER_CHECKREQUEST,
|
||||
array(
|
||||
'request' => $request,
|
||||
'controller' => get_class($this),
|
||||
));
|
||||
$event->setUser($user);
|
||||
PhutilEventEngine::dispatchEvent($event);
|
||||
$checker_controller = $event->getValue('controller');
|
||||
if ($checker_controller != get_class($this)) {
|
||||
return $this->delegateToController($checker_controller);
|
||||
}
|
||||
|
||||
if (PhabricatorEnv::getEnvConfig('darkconsole.enabled')) {
|
||||
if ($user->getConsoleEnabled() ||
|
||||
PhabricatorEnv::getEnvConfig('darkconsole.always-on')) {
|
||||
|
||||
Reference in New Issue
Block a user