You are here

public function SocialGroupRequestMembershipNotification::access in Open Social 8.9

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_group/modules/social_group_request/src/Plugin/Block/SocialGroupRequestMembershipNotification.php \Drupal\social_group_request\Plugin\Block\SocialGroupRequestMembershipNotification::access()
  2. 10.0.x modules/social_features/social_group/modules/social_group_request/src/Plugin/Block/SocialGroupRequestMembershipNotification.php \Drupal\social_group_request\Plugin\Block\SocialGroupRequestMembershipNotification::access()
  3. 10.1.x modules/social_features/social_group/modules/social_group_request/src/Plugin/Block/SocialGroupRequestMembershipNotification.php \Drupal\social_group_request\Plugin\Block\SocialGroupRequestMembershipNotification::access()
  4. 10.2.x modules/social_features/social_group/modules/social_group_request/src/Plugin/Block/SocialGroupRequestMembershipNotification.php \Drupal\social_group_request\Plugin\Block\SocialGroupRequestMembershipNotification::access()

Overrides BlockPluginTrait::access

File

modules/social_features/social_group/modules/social_group_request/src/Plugin/Block/SocialGroupRequestMembershipNotification.php, line 160

Class

SocialGroupRequestMembershipNotification
Provides a 'Membership requests notification' block.

Namespace

Drupal\social_group_request\Plugin\Block

Code

public function access(AccountInterface $account, $return_as_object = FALSE) {
  $is_group_page = isset($this->group);
  if ($this->group instanceof Group) {
    $is_group_manager = $this->group
      ->hasPermission('administer members', $account);
    return AccessResult::allowedIf($is_group_page && $is_group_manager);
  }
  return AccessResult::forbidden();
}