Exemplo n.º 1
0
 /**
  * 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));
     }
 }
Exemplo n.º 2
0
 /**
  * Retrieve current route.
  *
  * @return Route
  */
 protected function getCurrentRoute()
 {
     if (!$this->_route) {
         $this->_route = $this->_router->match($this->_request);
     }
     return $this->_route;
 }
Exemplo n.º 3
0
 /**
  * Retrieve current route.
  *
  * @return Route
  */
 public function getRoute()
 {
     if (!$this->route) {
         $this->route = $this->router->match($this->request);
     }
     return $this->route;
 }
Exemplo n.º 4
0
 /**
  * @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);
 }