method createPermByReal documentation in bbn\Appui\Ide
Creates a permission option from a real file/dir's path
function(string $file, string $type = 'file')
{
if (
!empty($file)
// It must be a controller
&& (strpos($file, '/src/mvc/public/') !== false)
&& ($perm = bbn\User\Permissions::getInstance())
) {
$is_file = $type === 'file';
// Check if it's an external route
$root_path = $this->getAppPath() . 'mvc/public/';
if (strpos($file, $root_path) === 0) {
// Remove root path
$f = substr($file, \strlen($root_path), \strlen($file) - 4);
}
else {
foreach ($this->routes as $r) {
if (strpos($file, $r['path']) === 0) {
// Remove route
$f = substr($file, strlen($r['path']) + strlen('src/mvc/public'), -4);
// Add the route's name to path
$f = str_replace('//', '/', $r['url'] . '/' . $f);
break;
}
}
}
return $perm->fromPath($f, 'access', true);
}
return false;
}
Creates a permission option from a real file/dir's path 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-2023
BBN Solutions