Skip to content

Commit

Permalink
Fix permission callback
Browse files Browse the repository at this point in the history
  • Loading branch information
joanrodas committed May 4, 2022
1 parent e4fa0ac commit 332b307
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion PluboRoutes/Route/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function getCapabilities()
public function getPermissionCallback()
{
$permission_callback = $this->config['permission_callback'] ?? false;
return ($permission_callback && is_callable($permission_callback));
return $permission_callback;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion PluboRoutes/RoutesProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private function executeRouteHook()
private function checkPermissionCallback()
{
$permission_callback = $this->matched_route->getPermissionCallback();
if (!$permission_callback) {
if (!$permission_callback || !is_callable($permission_callback)) {
return;
}
$has_access = call_user_func($permission_callback, $this->matched_args);
Expand Down

0 comments on commit 332b307

Please sign in to comment.