You are here

public function CalculatedGroupPermissionsItem::hasPermission in Group 2.0.x

Same name and namespace in other branches
  1. 8 src/Access/CalculatedGroupPermissionsItem.php \Drupal\group\Access\CalculatedGroupPermissionsItem::hasPermission()

Returns whether this item has a given permission.

This should take ::isAdmin() into account.

Parameters

string $permission: The permission name.

Return value

bool Whether this item has the permission.

Overrides CalculatedGroupPermissionsItemInterface::hasPermission

File

src/Access/CalculatedGroupPermissionsItem.php, line 95

Class

CalculatedGroupPermissionsItem
Represents a single entry for the calculated group permissions.

Namespace

Drupal\group\Access

Code

public function hasPermission($permission) {
  return $this
    ->isAdmin() || in_array($permission, $this->permissions, TRUE);
}