You are here

public function BBBMeetingModeratorAccessCheck::access in BigBlueButton 8

File

modules/bbb_node/src/Access/BBBMeetingModeratorAccessCheck.php, line 50

Class

BBBMeetingModeratorAccessCheck
Class BBBMeetingModeratorAccessCheck.

Namespace

Drupal\bbb_node\Access

Code

public function access(RouteMatchInterface $route_match, AccountInterface $account) {
  $node = $route_match
    ->getParameter('node');
  if (!$node instanceof NodeInterface) {
    $node = $this->nodeStorage
      ->load($node);
  }
  if (!$this->nodeMeeting
    ->isTypeOf($node)) {
    return AccessResult::forbidden();
  }

  // Check for access to attend meetings.
  if ($account
    ->hasPermission('bbb_node moderate meetings') || $account
    ->hasPermission('administer big blue button') || $account
    ->id() === $node
    ->getOwnerId() && $account
    ->hasPermission('bbb_node moderate own meetings')) {
    return AccessResult::allowed();
  }
  return AccessResult::neutral();
}