From 41e04a99f08973d924543d2c88847e7f50941109 Mon Sep 17 00:00:00 2001 From: Yann Jacquot Date: Thu, 18 Jun 2020 14:49:04 +0200 Subject: [PATCH] Support APIPlatform 2.5 by searching security keyword in resource metadata --- composer.json | 2 +- src/AccessControl/RouteAccessControlFactory.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 42f4828..e43d12e 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "symfony/dependency-injection": "^4.0|^5.0", "symfony/http-kernel": "^4.0|^5.0", "symfony/routing": "^4.0|^5.0", - "api-platform/core": ">=2.1.0 <2.5.0" + "api-platform/core": "^2.5" }, "autoload": { "psr-4": { diff --git a/src/AccessControl/RouteAccessControlFactory.php b/src/AccessControl/RouteAccessControlFactory.php index 4db749b..9c6513a 100644 --- a/src/AccessControl/RouteAccessControlFactory.php +++ b/src/AccessControl/RouteAccessControlFactory.php @@ -76,7 +76,7 @@ protected function getAccessControlExpressionForApiPlatform(Route $route): strin try { $resourceMetadata = $this->resourceMetadataFactory->create($resourceClass); $attributes = AttributesExtractor::extractAttributes($route->getDefaults()); - $isGranted = $resourceMetadata->getOperationAttribute($attributes, 'access_control', null, true); + $isGranted = $resourceMetadata->getOperationAttribute($attributes, 'security', null, true); if (null === $isGranted) { $isGranted = RouteAccessControlData::NO_ACCESS_CONTROL; }