0
I have a project based on Zend Framework 2 and the Myacl plugin; My operating system is Ubuntu 17.04; php version: 7.1.11. I cannot access the project homepage, an error occurs during authentication and the Myacl plugin controller page is not interpreted by the local server
sesscontainer) { $this->sesscontainer = new SessionContainer('lipq'); } return $this->sesscontainer; } public function doAuthorization($e) { $auth = new \Zend\Authentication\AuthenticationService(); $usuarioLogado = $auth->getIdentity(); $role = $usuarioLogado->tipo; $acl = new Acl(); $acl->deny(); // on by default //$acl->allow(); // this will allow every route by default so then you have to explicitly deny all routes that you want to protect. # ROLES ############################################ $acl->addRole(new Role('visitante')); $acl->addRole(new Role('usuario'), 'visitante'); $acl->addRole(new Role('admin'), 'usuario'); # end ROLES ######################################## # RESOURCES ######################################## $acl->addResource('application'); // Application module # end RESOURCES ######################################## // ################ PERMISSIONS ####################### // $acl->allow('role', 'resource', 'controller:action'); // Application --------------------------> $acl->allow('visitante', 'application', 'profile:index'); $acl->allow('visitante', 'application', 'usuarios:index'); $acl->allow('visitante', 'application', 'autenticar:index'); $acl->allow('visitante', 'application', 'autenticar:cadastro'); $acl->allow('usuario', 'application', 'usuarios:logout'); $acl->allow('usuario', 'application', 'impressao:index'); $acl->allow('admin', 'application', 'admin:acesso'); $acl->allow('admin', 'application', 'admin:index'); $acl->allow('admin', 'application', 'admin:cadastrocoordenador'); $acl->allow('admin', 'application', 'admin:lista'); $acl->allow('admin', 'application', 'admin:chamada'); $acl->allow('admin', 'application', 'admin:listachamada'); $acl->allow('admin', 'application', 'admin:listapropostas'); $acl->allow('usuario', 'application', 'download:index'); $acl->allow('usuario', 'application', 'remover:index'); $acl->allow('usuario', 'application', 'modulos:mdunidconsorc'); $acl->allow('usuario', 'application', 'modulos:mdtecnicas'); $acl->allow('usuario', 'application', 'modulos:mdanalise'); $acl->allow('usuario', 'application', 'modulos:mdamostra'); $acl->allow('usuario', 'application', 'painel:index'); $acl->allow('usuario', 'application', 'painel:panel1'); $acl->allow('usuario', 'application', 'painel:panel2'); $acl->allow('usuario', 'application', 'painel:panel3'); $acl->allow('usuario', 'application', 'painel:panel4'); $acl->allow('usuario', 'application', 'painel:panel5'); $acl->allow('usuario', 'application', 'painel:panel6'); $acl->allow('usuario', 'application', 'painel:panel7'); $acl->allow('usuario', 'application', 'painel:panel8'); $acl->allow('usuario', 'application', 'painel:panel9'); $acl->allow('usuario', 'application', 'painel:panel10'); $acl->allow('usuario', 'application', 'painel:panel11'); $acl->allow('usuario', 'application', 'painel:panel12'); $acl->allow('usuario', 'application', 'painel:consulta'); $acl->allow('usuario', 'application', 'visualizar:index'); $acl->allow('usuario', 'application', 'visualizar:panel1'); $acl->allow('usuario', 'application', 'visualizar:panel2'); $acl->allow('usuario', 'application', 'visualizar:panel3'); $acl->allow('usuario', 'application', 'visualizar:panel4'); $acl->allow('usuario', 'application', 'visualizar:panel5'); $acl->allow('usuario', 'application', 'visualizar:panel6'); $acl->allow('usuario', 'application', 'visualizar:panel7'); $acl->allow('usuario', 'application', 'visualizar:panel8'); $acl->allow('usuario', 'application', 'visualizar:panel9'); $acl->allow('usuario', 'application', 'visualizar:panel10'); $acl->allow('usuario', 'application', 'visualizar:panel11'); $acl->allow('usuario', 'application', 'visualizar:panel12'); $acl->allow('usuario', 'application', 'index:index'); $acl->allow('usuario', 'application', 'modelo:index'); //$acl->deny('role', 'resource', 'controller:action'); ################ end PERMISSIONS ##################### $controller = $e->getTarget(); $controllerClass = get_class($controller); $moduleName = strtolower(substr($controllerClass, 0, strpos($controllerClass, '\\'))); if($role != 'admin' && $role != 'usuario'){ $role = 'visitante'; } $routeMatch = $e->getRouteMatch(); $actionName = strtolower($routeMatch->getParam('action', 'not-found')); // get the action name $controllerName = $routeMatch->getParam('controller', 'not-found'); // get the controller name $controllerName = strtolower(array_pop(explode('\\', $controllerName))); /* print '
$moduleName: '.$moduleName.'
'; print '
$controllerClass: '.$controllerClass.'
'; print '$controllerName: '.$controllerName.'
'; print '$action: '.$actionName.'
'; */ #################### Check Access ######################## if (!$acl->isAllowed($role, $moduleName, $controllerName . ':' . $actionName)) { $router = $e->getRouter(); // $url = $router->assemble(array(), array('name' => 'Login/auth')); // assemble a login route $url = $router->assemble(array(), array('name' => 'usuarios')); $response = $e->getResponse(); $response->setStatusCode(302); // redirect to login page or other page. $response->getHeaders()->addHeaderLine('Location', $url); $e->stopPropagation(); } } }
This error is caused when php short_open_tag was not enabled
– EwertonDC
This error is caused when php
short_open_tag
was not enabled– EwertonDC