You are here

class BBBMeetingAttendeeAccessCheck in BigBlueButton 8

Class BBBMeetingAttendeeAccessCheck.

@package Drupal\bbb\Access

Hierarchy

Expanded class hierarchy of BBBMeetingAttendeeAccessCheck

1 string reference to 'BBBMeetingAttendeeAccessCheck'
bbb_node.services.yml in modules/bbb_node/bbb_node.services.yml
modules/bbb_node/bbb_node.services.yml
1 service uses BBBMeetingAttendeeAccessCheck
bbb_node.meeting.attendee_access_check in modules/bbb_node/bbb_node.services.yml
Drupal\bbb_node\Access\BBBMeetingAttendeeAccessCheck

File

modules/bbb_node/src/Access/BBBMeetingAttendeeAccessCheck.php, line 18

Namespace

Drupal\bbb_node\Access
View source
class BBBMeetingAttendeeAccessCheck implements AccessInterface {

  /**
   * Node based Meeting API.
   *
   * @var \Drupal\bbb_node\Service\NodeMeeting
   */
  protected $nodeMeeting;

  /**
   * Node storage.
   *
   * @var \Drupal\Core\Entity\EntityStorageInterface
   */
  protected $nodeStorage;

  /**
   * Constructs a BBBMeetingModeratorAccessCheck object.
   *
   * @param \Drupal\bbb_node\Service\NodeMeeting $node_meeting
   *   Node based Meeting API.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   Entity type manager.
   */
  public function __construct(NodeMeeting $node_meeting, EntityTypeManagerInterface $entity_type_manager) {
    $this->nodeMeeting = $node_meeting;
    $this->nodeStorage = $entity_type_manager
      ->getStorage('node');
  }

  /**
   * {@inheritdoc}
   */
  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();
    }
    if ($account
      ->hasPermission('bbb_node attend meetings') || $account
      ->hasPermission('administer big blue button')) {
      return AccessResult::allowed();
    }
    return AccessResult::neutral();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BBBMeetingAttendeeAccessCheck::$nodeMeeting protected property Node based Meeting API.
BBBMeetingAttendeeAccessCheck::$nodeStorage protected property Node storage.
BBBMeetingAttendeeAccessCheck::access public function
BBBMeetingAttendeeAccessCheck::__construct public function Constructs a BBBMeetingModeratorAccessCheck object.