Permalink
Browse files

throw immediately on access denied, otherwise the error code could ge…

…t overwritten in the interim
  • Loading branch information...
flack committed Feb 4, 2019
1 parent 5b105f9 commit ace016cb3674faf8827d9c53f17cfc015bbcbd54
Showing with 1 addition and 6 deletions.
  1. +1 −1 src/midcom/routing/parser.php
  2. +0 −5 src/midcom/routing/resolver.php
@@ -159,7 +159,7 @@ private function walk_topics()
if ($qb->count() == 0) {
// last load returned ACCESS DENIED, no sense to dig deeper
if ($qb->denied > 0) {
midcom_connection::set_error(MGD_ERR_ACCESS_DENIED);
throw new \midcom_error_forbidden;
}
// allow for handler switches to work
return;
@@ -121,11 +121,6 @@ public function process_component()
$result = $viewer->get_handler($this->request);
if (!$result) {
debug_add("Component {$topic->component} in {$topic->name} declared unable to handle request.", MIDCOM_LOG_INFO);
// We couldn't fetch a node due to access restrictions
if (midcom_connection::get_error() == MGD_ERR_ACCESS_DENIED) {
throw new midcom_error_forbidden(midcom::get()->i18n->get_string('access denied', 'midcom'));
}
throw new midcom_error_notfound("This page is not available on this server.");
}
$this->context->set_key(MIDCOM_CONTEXT_SHOWCALLBACK, [$viewer, 'show']);

0 comments on commit ace016c

Please sign in to comment.