You are here

function drush_workbench_access_flush in Workbench Access 8

Flushes assigned user permissions.

File

./workbench_access.drush.inc, line 100
Drush commands for Workbench Access.

Code

function drush_workbench_access_flush() {
  $section_storage = \Drupal::entityTypeManager()
    ->getStorage('section_association');
  foreach (\Drupal::entityTypeManager()
    ->getStorage('access_scheme')
    ->loadMultiple() as $scheme) {
    $sections = $section_storage
      ->loadByProperties([
      'access_scheme' => $scheme
        ->id(),
    ]);
    $section_storage
      ->delete($sections);
  }
  drush_print('User and role assignments cleared.');
}