Don't need a protected $roleStorage property in FarmMigrationSubscriber.

This commit is contained in:
Michael Stenta 2021-12-09 11:23:47 -05:00
parent 8d1114d940
commit 9c06862461
1 changed files with 4 additions and 10 deletions

View File

@ -40,13 +40,6 @@ class FarmMigrationSubscriber implements EventSubscriberInterface {
*/
protected $entityTypeManager;
/**
* The role storage.
*
* @var \Drupal\user\RoleStorageInterface
*/
protected $roleStorage;
/**
* The state key/value store.
*
@ -79,7 +72,6 @@ class FarmMigrationSubscriber implements EventSubscriberInterface {
$this->database = $database;
$this->time = $time;
$this->entityTypeManager = $entity_type_manager;
$this->roleStorage = $entity_type_manager->getStorage('user_role');
$this->state = $state;
$this->migrationPluginManager = $migration_plugin_manager;
}
@ -160,7 +152,8 @@ class FarmMigrationSubscriber implements EventSubscriberInterface {
// @see revokeTextFormatPermission()
$migration = $event->getMigration();
if (isset($migration->migration_group) && $migration->migration_group == 'farm_migrate_taxonomy') {
$anonymous = $this->roleStorage->load('anonymous');
$storage = $this->entityTypeManager->getStorage('user_role');
$anonymous = $storage->load('anonymous');
$anonymous->grantPermission('use text format default');
$anonymous->save();
}
@ -180,7 +173,8 @@ class FarmMigrationSubscriber implements EventSubscriberInterface {
// @see grantTextFormatPermission()
$migration = $event->getMigration();
if (isset($migration->migration_group) && $migration->migration_group == 'farm_migrate_taxonomy') {
$anonymous = $this->roleStorage->load('anonymous');
$storage = $this->entityTypeManager->getStorage('user_role');
$anonymous = $storage->load('anonymous');
$anonymous->revokePermission('use text format default');
$anonymous->save();
}