class JobItemAccessControlHandler

Access control handler for the job item entity.

Hierarchy

Expanded class hierarchy of JobItemAccessControlHandler

See also

\Drupal\tmgmt\Entity\Job.

File

src/Entity/Controller/JobItemAccessControlHandler.php, line 14

Namespace

Drupal\tmgmt\Entity\Controller
View source
class JobItemAccessControlHandler extends JobAccessControlHandler {

  /**
   * {@inheritdoc}
   */
  protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
    if ($operation === 'delete') {
      return AccessResult::allowedIf($entity
        ->isInactive());
    }
    else {
      if ($operation == 'abort') {
        return AccessResult::allowedIf($entity
          ->isActive() || $entity
          ->isNeedsReview());
      }
      else {
        if ($entity
          ->getJob()) {
          return $entity
            ->getJob()
            ->access($operation, $account, TRUE);
        }
      }
    }
  }

}

Members