You are here

protected function ScheduledUpdatesTestBase::revokePermissionsFromUser in Scheduled Updates 8

Grant permissions to a user.

The permissions are actually added to the users role. Relies on test users only having 1 non-locked role.

Parameters

array $permissions:

1 call to ScheduledUpdatesTestBase::revokePermissionsFromUser()
EmbeddedScheduledUpdateTypeTestBase::checkAfterTypeCreated in tests/src/FunctionalJavascript/EmbeddedScheduledUpdateTypeTestBase.php

File

tests/src/FunctionalJavascript/ScheduledUpdatesTestBase.php, line 276
Contains \Drupal\Tests\scheduled_updates\ScheduledUpdatesTestBase.

Class

ScheduledUpdatesTestBase
Define base class for Scheduled Updates Tests

Namespace

Drupal\Tests\scheduled_updates\FunctionalJavascript

Code

protected function revokePermissionsFromUser($permissions) {
  $roles = $this->adminUser
    ->getRoles(TRUE);
  $role_id = array_pop($roles);
  foreach ($permissions as $permission) {
    Role::load($role_id)
      ->revokePermission($permission);
  }
}