You are here

public function TeamPermission::access in Apigee Edge 8

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

modules/apigee_edge_teams/src/Plugin/views/access/TeamPermission.php, line 97

Class

TeamPermission
Access plugin for team-permission-based access control.

Namespace

Drupal\apigee_edge_teams\Plugin\views\access

Code

public function access(AccountInterface $account) {
  if ((int) $account
    ->id() === 1) {
    return TRUE;
  }
  $team = $this->routeMatch
    ->getParameter('team');
  if (!$team) {
    return FALSE;
  }
  return in_array($this->options['permission'], $this->teamPermissionHandler
    ->getDeveloperPermissionsByTeam($team, $account));
}