You are here

function bbb_node_node_access in BigBlueButton 8

Implements hook_node_access().

File

modules/bbb_node/bbb_node.module, line 69
Big Blue Button - Enables universities and colleges to deliver a high-quality learning experience.

Code

function bbb_node_node_access(NodeInterface $node, $op, AccountInterface $account) {

  /** @var \Drupal\bbb_node\Service\NodeMeeting $node_meeting */
  $node_meeting = \Drupal::service('bbb_node.meeting');
  if (in_array($op, [
    'create',
    'update',
  ]) && $node_meeting
    ->isTypeOf($node)) {

    // No bother to check for node access since this will be on edit/create pages.
    if ($account
      ->hasPermission('bbb_node record meetings') || $account
      ->hasPermission('administer big blue button')) {
      return AccessResult::allowed();
    }
    return AccessResult::forbidden();
  }
  return AccessResult::neutral();
}