method optionPermissionRoot documentation in bbn\User\Permissions
Returns
function(string $id, $create = false)
{
/** @var string The option's ID for appui */
$appui = $this->opt->fromCode('appui');
/** @var string The option's ID for plugins */
$plugins = $this->opt->fromCode('plugins');
/** @var array The parents, the first being root */
$parents = array_reverse($this->opt->parents($id));
$num = count($parents);
// Looking for the root of the options' permissions
if (($num > 2) && \in_array($parents[1], [$appui, $plugins])) {
if (($num > 4) && ($this->opt->code($parents[3]) === 'plugins')) {
/** @var string */
$root_parent = $this->opt->fromCode('plugins', 'permissions', $parents[2]);
if (!$root_parent) {
throw new Exception("Impossible to find a parent for plugin's permission ".$parents[2]);
}
$plugin = $this->opt->code($parents[4]);
if ($parents[1] === $appui) {
$alias = $this->opt->fromCode('options', 'permissions', $plugin, 'appui');
}
else {
$alias = $this->opt->fromCode('options', 'permissions', $plugin, 'plugins');
}
$id_root = $this->opt->fromCode($plugin, $root_parent);
if (!$id_root && $create) {
$id_root = $this->opt->add([
'id_parent' => $root_parent,
'code' => $plugin,
'text' => $plugin,
'id_alias' => $alias
]);
}
return $id_root;
}
return $this->opt->fromCode('options', 'permissions', $parents[2]);
}
/** @var string The option's ID of the permissions on options $id_option */
return $this->getOptionId('options');
}
Returns 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