You are here

public function GroupPermission::access in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/views/access/GroupPermission.php \Drupal\group\Plugin\views\access\GroupPermission::access()

Determine if the current user has access or not.

Parameters

\Drupal\Core\Session\AccountInterface $account: The user who wants to access this view.

Return value

bool Returns whether the user has access to the view.

Overrides AccessPluginBase::access

File

src/Plugin/views/access/GroupPermission.php, line 105

Class

GroupPermission
Access plugin that provides group permission-based access control.

Namespace

Drupal\group\Plugin\views\access

Code

public function access(AccountInterface $account) {
  if (!empty($this->group)) {
    return $this->group
      ->hasPermission($this->options['group_permission'], $account);
  }
  return FALSE;
}