You are here

public function ForumAccessCheck::access in Opigno forum 3.x

Same name and namespace in other branches
  1. 8 src/Access/ForumAccessCheck.php \Drupal\opigno_forum\Access\ForumAccessCheck::access()

Returns forum access.

File

src/Access/ForumAccessCheck.php, line 18

Class

ForumAccessCheck
Checks access for displaying forum page.

Namespace

Drupal\opigno_forum\Access

Code

public function access(RouteMatch $route_match, AccountInterface $account) {
  $forum = $route_match
    ->getParameter('taxonomy_term');
  if ($forum !== NULL) {
    if (!_opigno_forum_access($forum
      ->id(), $account)) {
      return AccessResult::forbidden();
    }
  }
  return AccessResult::allowed();
}