You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes#392 (#394) Visibility attribute for API product not enforced correctly
The Apigee M10n module’s hook_ENTITY_TYPE_access uses the Apigee Monetization API to determine an API Product ‘assign’ access by calling `/developers/{developer}/eligible-products`, which returns AccessResult::allowed for all API products.
This API returns all API Products
1. That are able to be assigned to an App because the developer purchased a Rate plan that contains the API product
2. All API products that are not monetized.
Due to #2, the Apigee Edge module hook_ENTITY_TYPE_access needs to return AccessResult::forbidden when the operation is ‘assign’ and the user does not have the correct role to assign an API product to an app.
@@ -386,12 +387,12 @@ function apigee_edge_api_product_access(EntityInterface $entity, $operation, Acc
386
387
// access setting but we should still grant view access
387
388
// if they have a developer app in association with this API product.
388
389
if (empty(array_intersect($visible_to_roles, $account->getRoles()))) {
389
-
// We should not return allowed if the operation is "assign"
390
-
// just because a user has an app with the API product.
391
-
// Displaying these API products to a user should be solved on the
392
-
// form level always.
390
+
393
391
if ($operation === 'assign') {
394
-
$result = AccessResult::neutral();
392
+
// If the apigee_edge.settings.developer.api_product_access settings
393
+
// limits access to this API product, do not allow user to assign it
394
+
// to an application.
395
+
$result = AccessResult::forbidden("User {$account->getEmail()} is does not have permissions to see API Product with visibility {$product_visibility}.");
0 commit comments