method isAuthorizedRoute documentation in bbn\Mvc
Checks if a route is authorized.
function($url)
{
if (in_array($url, $this->authorized_routes, true)) {
return true;
}
if ($this->isStaticRoute($url)) {
return true;
}
$has_allow_all = false;
$auth_applicable = '';
foreach ($this->authorized_routes as $ar) {
if ($ar === '*') {
$has_allow_all = true;
continue;
}
if ((substr($ar, -1) === '*')
&& (strpos($url, substr($ar, 0, -1)) === 0)
) {
if (strlen($ar) > strlen($auth_applicable)) {
$auth_applicable = substr($ar, 0, -1);
}
}
}
if ($auth_applicable || $has_allow_all) {
foreach ($this->forbidden_routes as $forbidden) {
if ((substr($forbidden, -1) === '*')
&& (strpos($url, substr($forbidden, 0, -1)) === 0)
// Should be as or more precise
&& (strlen($auth_applicable) < strlen($forbidden))
) {
return false;
} elseif ($url === $forbidden) {
return false;
}
}
return true;
}
return false;
}
Checks if a route is authorized. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions