/** * @see \Vero\ACL\ACL::check() * @return boolean */ public function check($key, $role = null) { if (!$this->acl) { $this->acl = $this->container->get($this->service); } return $this->acl->check($key, $role); }
/** * Check current user's access to this action * and throw exception in case of fail. * * If key is unspecified, get Route ID of current request action. * * @param string|null * @return true * @throws \Vero\Web\Exception\AccessDenied */ public function aclCheck($key = null) { if (!$key) { $key = $this->get('request')->action; } if (!$this->acl->check($key)) { throw $this->accessDenied($key); } return true; }
protected function create(Container $c) { if ($c->has('acl-backend')) { $backend = $c->get('acl-backend'); } else { $backend = new A\Backend\XML($c->get('app')->path('resources/acl/'), $c->get('cache')); } $acl = new A\ACL($backend); if ($c->has('auth')) { $acl->setSessionRole($c->get('auth')->getUser()); } return $acl; }