public function CustomQueryParameterNamesAccessCheck::access in JSON:API 8
Denies access when using invalid custom JSON API query parameter names.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The request.
Return value
\Drupal\Core\Access\AccessResult The access result.
File
- src/
Access/ CustomQueryParameterNamesAccessCheck.php, line 28
Class
- CustomQueryParameterNamesAccessCheck
- Validates custom (implementation-specific) query parameter names.
Namespace
Drupal\jsonapi\AccessCode
public function access(Request $request) {
$json_api_params = $request->attributes
->get('_json_api_params', []);
if (!$this
->validate($json_api_params)) {
return AccessResult::forbidden();
}
return AccessResult::allowed();
}