Skip to content

Commit

Permalink
Added inspection for 'route' to get a route pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
geggleto committed Jan 8, 2016
1 parent d55601b commit 74973db
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/AclRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,16 @@ public function __invoke(ServerRequestInterface $requestInterface, ResponseInter
}
}

//This is likely Slim 3 specific code...
$route = $requestInterface->getAttribute('route');
if (!empty($route)) {
foreach ($this->role as $role) {
if ($this->isAllowed($role, $route->getPattern())) {
$allowed = true;
}
}
}

if ($allowed) {
return $next($requestInterface, $responseInterface);
} else {
Expand Down

0 comments on commit 74973db

Please sign in to comment.