private function TeamMemberApiProductAccessHandler::checkAccess in Apigee Edge 8
Performs access checks.
Parameters
\Drupal\apigee_edge\Entity\ApiProductInterface $api_product: The API Product entity for which to check access.
string $operation: The entity operation. Usually one of 'view', 'update', 'create', 'delete' or 'assign".
\Drupal\apigee_edge_teams\Entity\TeamInterface $team: The team for which to check access.
\Drupal\Core\Session\AccountInterface $account: The team member for which to check access.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
1 call to TeamMemberApiProductAccessHandler::checkAccess()
- TeamMemberApiProductAccessHandler::access in modules/
apigee_edge_teams/ src/ TeamMemberApiProductAccessHandler.php - Checks access to an operation on a given API product.
File
- modules/
apigee_edge_teams/ src/ TeamMemberApiProductAccessHandler.php, line 159
Class
- TeamMemberApiProductAccessHandler
- Default team member API product access handler implementation.
Namespace
Drupal\apigee_edge_teamsCode
private function checkAccess(ApiProductInterface $api_product, string $operation, TeamInterface $team, AccountInterface $account) : AccessResultInterface {
if (!in_array($operation, [
'view',
'view label',
'assign',
])) {
return AccessResult::neutral(sprintf('%s is not supported by %s.', $operation, __FUNCTION__));
}
$product_visibility = $api_product
->getAttributeValue('access') ?? 'public';
return AccessResult::allowedIf(in_array("api_product_access_{$product_visibility}", $this->teamPermissionHandler
->getDeveloperPermissionsByTeam($team, $account)))
->addCacheableDependency($team)
->addCacheableDependency($api_product)
->addCacheableDependency($account);
}