You are here

public function CalculatedGroupPermissionsItem::__construct in Group 2.0.x

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

Constructs a new CalculatedGroupPermissionsItem.

Parameters

string $scope: The scope name.

string|int $identifier: The identifier within the scope.

string[] $permissions: The permission names.

bool $is_admin: (optional) Whether the item grants admin privileges.

File

src/Access/CalculatedGroupPermissionsItem.php, line 52

Class

CalculatedGroupPermissionsItem
Represents a single entry for the calculated group permissions.

Namespace

Drupal\group\Access

Code

public function __construct($scope, $identifier, $permissions, $is_admin = NULL) {
  $this->scope = $scope;
  $this->identifier = $identifier;
  $this->permissions = array_unique($permissions);

  // @todo Rework for group 8.2.x to no longer use the admin permission.
  // @todo Do make flag default to FALSE and pass role's isAdmin flag instead.
  $this->isAdmin = isset($is_admin) ? $is_admin : in_array('administer group', $permissions, TRUE);
}