You are here

class ChecklistapiAccessCheck in Checklist API 8

An access check service for checklist routes.

Hierarchy

Expanded class hierarchy of ChecklistapiAccessCheck

1 string reference to 'ChecklistapiAccessCheck'
checklistapi.services.yml in ./checklistapi.services.yml
checklistapi.services.yml
1 service uses ChecklistapiAccessCheck
access_check.checklistapi in ./checklistapi.services.yml
Drupal\checklistapi\Access\ChecklistapiAccessCheck

File

src/Access/ChecklistapiAccessCheck.php, line 12

Namespace

Drupal\checklistapi\Access
View source
class ChecklistapiAccessCheck implements AccessInterface {

  /**
   * Checks routing access for the checklist.
   *
   * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
   *   The current route match.
   *
   * @return \Drupal\Core\Access\AccessResult
   *   Returns an access result.
   */
  public function access(RouteMatchInterface $route_match) {
    $op = $route_match
      ->getParameter('op') ?: 'any';
    $id = $route_match
      ->getParameter('checklist_id');
    if (!$id) {
      return AccessResult::neutral();
    }
    return AccessResult::allowedIf(checklistapi_checklist_access($id, $op));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ChecklistapiAccessCheck::access public function Checks routing access for the checklist.