You are here

public function GroupRole::grantPermissions in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/GroupRole.php \Drupal\group\Entity\GroupRole::grantPermissions()

Grants multiple permissions to the role.

Parameters

string[] $permissions: The permissions to grant.

Return value

\Drupal\group\Entity\GroupRoleInterface The group role this was called on.

Overrides GroupRoleInterface::grantPermissions

3 calls to GroupRole::grantPermissions()
GroupRole::changePermissions in src/Entity/GroupRole.php
Changes permissions for the role.
GroupRole::grantAllPermissions in src/Entity/GroupRole.php
Grants all available permissions to the role.
GroupRole::grantPermission in src/Entity/GroupRole.php
Grants a permission to the role.

File

src/Entity/GroupRole.php, line 227

Class

GroupRole
Defines the Group role configuration entity.

Namespace

Drupal\group\Entity

Code

public function grantPermissions($permissions) {
  $this->permissions = array_unique(array_merge($this->permissions, $permissions));
  return $this;
}