diff --git a/src/Commands/DrushCommands.php b/src/Commands/DrushCommands.php index aa8d3a818f6b633e7d0a42f7cbdbe17f0e07b9b2..3f491213e0469a2e55995bc115fd0f211a4f5a14 100644 --- a/src/Commands/DrushCommands.php +++ b/src/Commands/DrushCommands.php @@ -2,6 +2,7 @@ namespace Drupal\drupalorg\Commands; +use Drupal\Core\Site\Settings; use Drupal\drupalorg\Utilities\ActiveInstalls; use Drupal\drupalorg\Utilities\ComposerNamespace; use Drupal\drupalorg\Utilities\CoreCompatibility; @@ -80,4 +81,25 @@ class DrushCommands extends BaseDrushCommands { } } + /** + * This is a D10 role only which gets overwritten when a user is re-synced via migrations. + * + * @command drupalorg:fix-landing-page-administrator-role + * @usage drush drupalorg:fix-landing-page-administrator-role + */ + public function fixLandingPageAdministratorRoles() { + $allowed_users = Settings::get('drupalorg_allowed_users'); + if (is_array($allowed_users)) { + foreach ($allowed_users as $allowed_user) { + if ($allowed_user !== '*') { + $user = user_load_by_name($allowed_user); + if ($user) { + $user->addRole('landing_pages_administrator'); + $user->save(); + } + } + } + } + } + }