You are here

protected function ApiProductAccessTest::messageIfUserShouldNotHaveAccess in Apigee Edge 8

Error message, when a user should not have access to an API product.

Parameters

string $operation: Operation on API product.

\Drupal\user\UserInterface $user: User object.

string $user_rid: Currently tested role of the user.

array $rids_with_access: Roles with access to the API product.

\Drupal\apigee_edge\Entity\ApiProductInterface $product: API Product.

Return value

string Error message.

1 call to ApiProductAccessTest::messageIfUserShouldNotHaveAccess()
ApiProductAccessTest::entityAccessTest in tests/src/FunctionalJavascript/ApiProductAccessTest.php
Tests "Access by visibility" access control.
1 method overrides ApiProductAccessTest::messageIfUserShouldNotHaveAccess()
ApiProductRoleBasedAccessTestBase::messageIfUserShouldNotHaveAccess in modules/apigee_edge_apiproduct_rbac/tests/src/FunctionalJavascript/ApiProductRoleBasedAccessTestBase.php
Error message, when a user should not have access to an API product.

File

tests/src/FunctionalJavascript/ApiProductAccessTest.php, line 490

Class

ApiProductAccessTest
Validates built-in access control on API products.

Namespace

Drupal\Tests\apigee_edge\FunctionalJavascript

Code

protected function messageIfUserShouldNotHaveAccess(string $operation, UserInterface $user, string $user_rid, array $rids_with_access, ApiProductInterface $product) : string {
  return sprintf('"%s" user without "Bypass API Product access control" permission should not have "%s" access to an API Product with "%s" visibility. Roles with access granted: %s.', $user_rid, $operation, $product
    ->getAttributeValue('access') ?? 'public', empty($rids_with_access) ? 'none' : implode(', ', $rids_with_access));
}