diff --git a/CHANGELOG.md b/CHANGELOG.md index 788c2f30..109eb3e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. ## [Unreleased] -- Update docker build to publish to "os2display" org on docker hup. Update github workflow to latest actions. +- Update docker build to publish to "os2display" org on docker hub. Update github workflow to latest actions. - Updated `EventDatabaseApiFeedType` query ensuring started but not finished events are found. - Refactored all feed related classes and services diff --git a/src/Command/User/AddUserCommand.php b/src/Command/User/AddUserCommand.php index a18aad5c..7f60010c 100644 --- a/src/Command/User/AddUserCommand.php +++ b/src/Command/User/AddUserCommand.php @@ -165,11 +165,11 @@ protected function interact(InputInterface $input, OutputInterface $output): voi $this->io->text(' > Role: '.$role); } else { $question = new ChoiceQuestion( - 'Please select the users role (defaults to editor)', - ['editor', 'admin'], + 'Please select the user\'s role (defaults to editor)', + CommandInputValidator::ALLOWED_USER_ROLES, 0 ); - $question->setErrorMessage('Color %s is invalid.'); + $question->setErrorMessage('Role %s is invalid.'); $role = $helper->ask($input, $output, $question); $output->writeln('You have just selected: '.$role); @@ -284,7 +284,7 @@ private function getCommandHelp(): string If you omit any of the required arguments, the command will ask you to provide the missing values: - # command will ask you for the password etc + # command will ask you for the password etc. php %command.full_name% email # command will ask you for all arguments diff --git a/src/Utils/CommandInputValidator.php b/src/Utils/CommandInputValidator.php index 001747cc..8cbc0e38 100644 --- a/src/Utils/CommandInputValidator.php +++ b/src/Utils/CommandInputValidator.php @@ -24,6 +24,8 @@ */ class CommandInputValidator { + public const ALLOWED_USER_ROLES = ['editor', 'admin']; + public function __construct( private TenantRepository $tenantRepository, ) {} @@ -95,8 +97,7 @@ public function validateRole(?string $role): string throw new InvalidArgumentException('The role can not be empty.'); } - $allowedRoles = ['editor', 'admin']; - if (!in_array($role, $allowedRoles)) { + if (!in_array($role, self::ALLOWED_USER_ROLES)) { throw new InvalidArgumentException('Unknown role: '.$role); }