/** * Checks if the current user has the priviledge to do something. * * @param string $priviledge * @return AccessProhibitedException **/ protected function _checkAcl($priviledge) { $service = new UserService($this->_em); if (!$this->_acl->isAllowed($service->getCurrentRole(), $this, $priviledge)) { throw new AccessProhibitedException('Access is prohibited.'); } }
/** * Returns DisplayComments instance. * * @param ServiceLocatorInterface $serviceLocator * @return DisplayQuote * @override **/ public function createService(ServiceLocatorInterface $serviceLocator) { /* @var $serviceLocator Zend\View\HelperPluginManager */ $sm = $serviceLocator->getServiceLocator(); $em = $sm->get('em'); $service = new UserService($em); $role = $service->getCurrentRole(); $helper = new DisplayComments(); $helper->setRole($role); return $helper; }