You are here

public function AccessManager::rolesChanged in Administer Users by Role 8.3

Acts on changes to configured roles.

Overrides AccessManagerInterface::rolesChanged

File

src/Services/AccessManager.php, line 50

Class

AccessManager
Access Manager.

Namespace

Drupal\administerusersbyrole\Services

Code

public function rolesChanged() {
  $role_config = [];
  foreach (array_keys($this
    ->managedRoles()) as $rid) {
    $role_config[$rid] = $this->config
      ->get("roles.{$rid}") ?: self::UNSAFE;
  }
  $this->configFactory
    ->getEditable('administerusersbyrole.settings')
    ->set('roles', $role_config)
    ->save();
}