You are here

scheduler_access_test.module in Scheduler 8

Same filename and directory in other branches
  1. 2.x tests/modules/scheduler_access_test/scheduler_access_test.module

Installation file for Scheduler Access Test module.

File

tests/modules/scheduler_access_test/scheduler_access_test.module
View source
<?php

/**
 * @file
 * Installation file for Scheduler Access Test module.
 */
use Drupal\Core\Session\AccountInterface;
use Drupal\node\NodeInterface;

/**
 * Implements hook_node_access_records().
 */
function scheduler_access_test_node_access_records(NodeInterface $node) {

  // For the purpose of this test we deny access to every node regardless of
  // its published status.
  $grants = [
    [
      'realm' => 'scheduler',
      'gid' => 1,
      'grant_view' => 0,
      'grant_update' => 0,
      'grant_delete' => 0,
    ],
  ];
  return $grants;
}

/**
 * Implements hook_node_grants().
 */
function scheduler_access_test_node_grants(AccountInterface $account, $op) {

  // This hook needs to exist, but we do not return any grants.
  return [];
}