public function isGranted(Route $route, User $user) { if ($Ctrl = $route->getDefault('_controller')) { $Ctrl = str_replace(array('Bundle', 'Controller', 'Action'), '', $Ctrl); list(, $Bundle, , $C) = explode("\\", strtolower($Ctrl)); list($Controller, $Action) = explode("::", $C); } foreach ($user->getRoles() as $Role) { if ($Role->isGranted($Bundle, $Controller, $Action) === TRUE) { return TRUE; } } return FALSE; }
/** * {@inheritDoc} */ public function getRoles() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getRoles', array()); return parent::getRoles(); }