You are here

function certificate_test_entity_access in Certificate 4.x

Parameters

EntityInterface $entity:

type $operation:

AccountInterface $account:

Return value

AccessResult $access

File

modules/certificate_test/certificate_test.module, line 14

Code

function certificate_test_entity_access(EntityInterface $entity, $operation, AccountInterface $account) {
  if ($entity
    ->getEntityTypeId() == 'certificate_test_entity' && $operation == 'certificate') {
    if ($account
      ->getEmail() == 'certified@example.com') {
      return AccessResult::allowed();
    }
    else {
      return AccessResult::forbidden();
    }
  }
}