Checks for access to route.
\Symfony\Component\Routing\Route $route: The route to check against.
\Symfony\Component\HttpFoundation\Request $request: The request object.
mixed TRUE if access is allowed. FALSE if not. NULL if no opinion.
Overrides AccessCheckInterface::access
public function access(Route $route, Request $request) {
if ($format = $request->attributes
->get('filter_format')) {
// Handle special cases up front. All users have access to the fallback
// format.
if ($format->format == filter_fallback_format()) {
return TRUE;
}
// Check the permission if one exists; otherwise, we have a non-existent
// format so we return FALSE.
$permission = filter_permission_name($format);
return !empty($permission) && user_access($permission);
}
}