You are here

protected function GroupContentEnablerBase::viewAccess in Group 8

Performs access check for the view operation.

This method is supposed to be overwritten by extending classes that do their own custom access checking.

Parameters

\Drupal\group\Entity\GroupContentInterface $group_content: The group content for which to check access.

\Drupal\Core\Session\AccountInterface $account: The user for which to check access.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

1 call to GroupContentEnablerBase::viewAccess()
GroupContentEnablerBase::checkAccess in src/Plugin/GroupContentEnablerBase.php
Checks access to an operation on a given group content entity.

File

src/Plugin/GroupContentEnablerBase.php, line 327

Class

GroupContentEnablerBase
Provides a base class for GroupContentEnabler plugins.

Namespace

Drupal\group\Plugin

Code

protected function viewAccess(GroupContentInterface $group_content, AccountInterface $account) {
  $group = $group_content
    ->getGroup();
  $plugin_id = $this
    ->getPluginId();
  return GroupAccessResult::allowedIfHasGroupPermission($group, $account, "view {$plugin_id} content");
}