protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
if ($operation == 'delete') {
return AccessResult::forbidden();
}
if ($account
->hasPermission('administer tmgmt') || $account
->hasPermission('administer translation tasks')) {
// Administrators can do everything.
return AccessResult::allowed()
->cachePerPermissions();
}
switch ($operation) {
case 'view':
case 'update':
return AccessResult::allowedIfHasPermission($account, 'provide translation services');
// Custom operations.
// Custom operations.
case 'unassign':
return AccessResult::allowedIf($entity->tuid->target_id == $account
->id() && $account
->hasPermission('provide translation services'));
}
return AccessResult::neutral();
}