You are here

protected function ApiProductRoleBasedAccessTestBase::messageIfUserShouldHaveAccessByRole in Apigee Edge 8

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

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.

Overrides ApiProductAccessTest::messageIfUserShouldHaveAccessByRole

File

modules/apigee_edge_apiproduct_rbac/tests/src/FunctionalJavascript/ApiProductRoleBasedAccessTestBase.php, line 105

Class

ApiProductRoleBasedAccessTestBase
Base calls for validating role based access control on API products.

Namespace

Drupal\Tests\apigee_edge_apiproduct_rbac\FunctionalJavascript

Code

protected function messageIfUserShouldHaveAccessByRole(string $operation, UserInterface $user, string $user_rid, array $rids_with_access, ApiProductInterface $product) : string {
  return sprintf('User with "%s" role should have "%s" access to this API Product. RBAC attribute value: "%s". Roles with access granted: %s.', $user_rid, $operation, $product
    ->getAttributeValue($this->rbacAttributeName), implode(', ', $rids_with_access));
}