method toPath documentation in bbn\User\Permissions
Returns the path corresponding to the given ID
function(string $id_option)
{
$bits = $this->opt->getCodePath($id_option);
// Minimum: appui, plugin, permissions, path
if (empty($bits) || (count($bits) < 4)) {
return null;
}
$bits = array_reverse($bits);
if (array_shift($bits) !== 'appui') {
return null;
}
$root = array_shift($bits);
$ok = false;
$prefix = '';
// Main application
if ($root === 'permissions') {
if (array_shift($bits) !== 'access') {
throw new Exception("The permission should be under access");
}
$ok = true;
}
// Plugins
elseif ($plugin = X::getRow($this->plugins, ['name' => 'appui-'.$root])) {
if ((array_shift($bits) !== 'permissions') || (array_shift($bits) !== 'access')) {
throw new Exception("The permission should be under permissions/access of the plugin");
}
$prefix = $plugin['url'].'/';
$ok = true;
}
if ($ok) {
return $prefix.X::join($bits, '');
}
return null;
}
Returns the path corresponding to the given ID 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