public function authorized($prefix, $path)
{
// Check blocked resources
foreach ($this->blocked as $rule) {
if (preg_match($rule, $path)) {
return false;
}
}
// Check allowed filesystems
foreach ($this->allowedPrefixes as $allowedPrefix) {
if ($allowedPrefix === $prefix) {
return true;
}
}
// Check allowed resources
foreach ($this->allowed as $rule) {
if (preg_match($rule, $path)) {
return true;
}
}
return false;
}