function(array $routes = NULL)
{
if (!($this->opt = Option::getInstance())) {
throw new Exception(X::_('Impossible to construct permissions: you need to instantiate options before'));
}
if (!($this->user = User::getInstance())) {
throw new Exception(X::_('Impossible to construct permissions: you need to instantiate user before'));
}
if (!($this->pref = Preferences::getInstance())) {
throw new Exception(X::_('Impossible to construct permissions: you need to instantiate preferences before'));
}
/** @todo Add the default routes from Mvc::getInstance */
if (empty($routes)) {
$mvc = Mvc::getInstance();
$routes = $mvc->getRoutes();
}
if ($routes) {
if (!empty($routes['root'])) {
foreach ($routes['root'] as $url => $plugin) {
$plugin['url'] = $url;
$this->plugins[] = $plugin;
}
}
if (!empty($routes['allowed']) && is_array($routes['allowed'])) {
$this->allowedRoutes = $routes['allowed'];
}
if (!empty($routes['forbidden']) && is_array($routes['forbidden'])) {
$this->forbiddenRoutes = $routes['forbidden'];
}
}
self::retrieverInit($this);
self::optionalInit();
$this->db = Db::getInstance();
}