protected function EntityResource::generateFallbackAccessDeniedMessage in Drupal 8
Same name and namespace in other branches
- 9 core/modules/rest/src/Plugin/rest/resource/EntityResource.php \Drupal\rest\Plugin\rest\resource\EntityResource::generateFallbackAccessDeniedMessage()
Generates a fallback access denied message, when no specific reason is set.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity object.
string $operation: The disallowed entity operation.
Return value
string The proper message to display in the AccessDeniedHttpException.
1 call to EntityResource::generateFallbackAccessDeniedMessage()
- EntityResource::post in core/
modules/ rest/ src/ Plugin/ rest/ resource/ EntityResource.php - Responds to entity POST requests and saves the new entity.
File
- core/
modules/ rest/ src/ Plugin/ rest/ resource/ EntityResource.php, line 348
Class
- EntityResource
- Represents entities as resources.
Namespace
Drupal\rest\Plugin\rest\resourceCode
protected function generateFallbackAccessDeniedMessage(EntityInterface $entity, $operation) {
$message = "You are not authorized to {$operation} this {$entity->getEntityTypeId()} entity";
if ($entity
->bundle() !== $entity
->getEntityTypeId()) {
$message .= " of bundle {$entity->bundle()}";
}
return "{$message}.";
}