/** * Perform authentication and authorization. * * @throws \Magento\Framework\Exception\AuthorizationException * @return void */ private function checkPermissions() { $route = $this->router->match($this->request); if (!$this->authorization->isAllowed($route->getAclResources())) { $params = ['resources' => implode(', ', $route->getAclResources())]; throw new AuthorizationException(__(AuthorizationException::NOT_AUTHORIZED, $params)); } }
/** * Retrieve current route. * * @return Route */ protected function getCurrentRoute() { if (!$this->_route) { $this->_route = $this->_router->match($this->_request); } return $this->_route; }
/** * Retrieve current route. * * @return Route */ public function getRoute() { if (!$this->route) { $this->route = $this->router->match($this->request); } return $this->route; }
/** * @expectedException \Magento\Framework\Webapi\Exception */ public function testNotMatch() { $this->_apiConfigMock->expects($this->once())->method('getRestRoutes')->will($this->returnValue([$this->_routeMock])); $this->_routeMock->expects($this->once())->method('match')->with($this->_request)->will($this->returnValue(false)); $this->_router->match($this->_request); }