Creates the super admin user.

@param Command $command
@param OutputInterface $output
324376
private function createSuperAdmin(Command $command, OutputInterface $output)
    {
        $groupRepository = $this->container->get('ekyna_user.group.repository');
        $userRepository = $this->container->get('ekyna_user.user.repository');

        /** @var \Ekyna\Bundle\UserBundle\Model\GroupInterface $group */
        if (null === $group = $groupRepository->findOneBy(['name' => array_keys($this->defaultGroups)[0]])) {
            $output->writeln('Super admin group not found, aborting.');
            return;
        }

        /** @var \Ekyna\Bundle\UserBundle\Model\UserInterface $superAdmin */
        if (null !== $superAdmin = $userRepository->findOneBy(['group' => $group])) {
            $output->writeln(sprintf('Super admin already exists (<comment>%s</comment>).', $superAdmin->getEmail()));
            return;
        }

        $output->writeln('<question>Please provide initial informations ...</question>');

        /** @var \Symfony\Component\Console\Helper\DialogHelper $dialog */
        $dialog = $command->getHelperSet()->get('dialog');

        $email = $dialog->askAndValidate($output, 'Email: ', function ($answer) use ($userRepository) {
            if (!filter_var($answer, FILTER_VALIDATE_EMAIL)) {
                throw new \RuntimeException('This is not a valid email address.');
            }
            if (null !== $userRepository->findOneBy(['email' => $answer])) {
                throw new \RuntimeException('This email address is already used.');
            }
            return $answer;
        }, 3);

        $password = $dialog->askAndValidate($output, 'Password: ', function ($answer) {
            if (!(preg_match('#^[a-zA-Z0-9]+$#', $answer) && strlen($answer) > 5)) {
                throw new \RuntimeException('Password should be composed of at least 6 letters and numbers.');
            }
            return $answer;
        }, 3);

        $notBlankValidator = function ($answer) {
            if (0 === strlen($answer)) {
                throw new \RuntimeException('This cannot be blank.');
            }
            return $answer;
        };

        $firstName = $dialog->askAndValidate($output, 'First name: ', $notBlankValidator, 3);
        $lastName = $dialog->askAndValidate($output, 'Last name: ', $notBlankValidator, 3);

        $userManager = $this->container->get('fos_user.user_manager');
        /** @var \Ekyna\Bundle\UserBundle\Model\UserInterface $user */
        $user = $userManager->createUser();
        $user
            ->setGroup($group)
            ->setGender('mr')
            ->setFirstName($firstName)
            ->setLastName($lastName)
            ->setPlainPassword($password)
            ->setEmail($email)
            ->setEnabled(true);
        $userManager->updateUser($user);

        $output->writeln('Super Admin has been successfully created.');
    }
176853
def create_user
      @admin = Admin.new(administrator_params)
      @admin.access_level = 'admin'
      @admin.overlord = 'Y'
      
      respond_to do |format|
        if @admin.save
          Setting.save_data({setup_complete: 'Y'})
          clear_cache
          session[:setup_complete] = true
          format.html { redirect_to admin_path, notice: I18n.t("controllers.admin.setup.general.success") }
        else
          format.html { render action: "administrator" }
        end
      end

    end
910022
protected function execute(InputInterface $input, OutputInterface $output): ?int
    {
        $username = $this->getUsername($input, $output);
        $user = $this->findUser($output, $username);
        if (null === $user) {
            return 1;
        }

        $password = $this->getPassword($input, $output);
        if ($password) {
            $this->userManager->setPlainTextPassword($user, $password);
        } else {
            $this->userManager->requestNewPassword($user);
        }
        $this->userManager->save($user);

        if ($password) {
            $message = $this->translator->trans(
                'user.password_changed_success',
                ['%username%' => $username],
                'security'
            );
        } else {
            $message = $this->translator->trans(
                'user.password_request_sent',
                ['%username%' => $username],
                'security'
            );
        }
        $output->writeln("<info>{$message}</info>");

        return 0;
    }
840792
public function configureAcls(
        OutputInterface $output,
        AdminInterface $admin,
        \Traversable $oids,
        UserSecurityIdentity $securityIdentity = null
    ) {
        $countAdded = 0;
        $countUpdated = 0;
        $securityHandler = $admin->getSecurityHandler();
        if (!$securityHandler instanceof AclSecurityHandlerInterface) {
            $output->writeln(sprintf('Admin `%s` is not configured to use ACL : <info>ignoring</info>', $admin->getCode()));

            return [0, 0];
        }

        $acls = $securityHandler->findObjectAcls($oids);

        foreach ($oids as $oid) {
            if ($acls->contains($oid)) {
                $acl = $acls->offsetGet($oid);
                ++$countUpdated;
            } else {
                $acl = $securityHandler->createAcl($oid);
                ++$countAdded;
            }

            if (null !== $securityIdentity) {
                // add object owner
                $securityHandler->addObjectOwner($acl, $securityIdentity);
            }

            $securityHandler->addObjectClassAces($acl, $securityHandler->buildSecurityInformation($admin));

            try {
                $securityHandler->updateAcl($acl);
            } catch (\Exception $e) {
                $output->writeln(sprintf('Error saving ObjectIdentity (%s, %s) ACL : %s <info>ignoring</info>', $oid->getIdentifier(), $oid->getType(), $e->getMessage()));
            }
        }

        return [$countAdded, $countUpdated];
    }
972897
protected function initialize(InputInterface $input, OutputInterface $output)
    {
        parent::initialize($input, $output);
        $this->permissionResolver->setCurrentUserReference(
            $this->userService->loadUserByLogin($input->getOption('user'))
        );
    }
336320
public function runCreateAdmin()
    {
        $admin = $this->getContainer()->get('fos_user.user_manager')->findOneBy(
            [
                'username' => 'admin',
            ]
        );

        if (!$admin) {
            $this->runCommand(
                'fos:user:create',
                [
                    '--super-admin' => true,
                    'username' => 'admin',
                    'email' => 'admin@admin.com',
                    'password' => 'admin',
                ]
            );
        }
    }
972809
protected function setupAdministrator()
    {
        $question = new ConfirmationQuestion('Would you like to create default administrator user (Recommended)? [y/n] ', true);
        if (!$this->helper->ask($this->input, $this->output, $question)) {
            return;
        }

        $this->runCommand('avoo:user:create');
    }
665599
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $userService = new UserService($this->userStore);

        /** @var $dialog \Symfony\Component\Console\Helper\DialogHelper */
        $dialog = $this->getHelperSet()->get('dialog');

        // Function to validate mail address.
        $mailValidator = function ($answer) {
            if (!filter_var($answer, FILTER_VALIDATE_EMAIL)) {
                throw new \InvalidArgumentException(Lang::get('must_be_valid_email'));
            }

            return $answer;
        };

        $adminEmail = $dialog->askAndValidate($output, Lang::get('enter_email'), $mailValidator, false);
        $adminName = $dialog->ask($output, Lang::get('enter_name'));
        $adminPass = $dialog->askHiddenResponse($output, Lang::get('enter_password'));

        try {
            $userService->createUser($adminName, $adminEmail, $adminPass, true);
            $output->writeln(Lang::get('user_created'));
        } catch (\Exception $e) {
            $output->writeln(sprintf('<error>%s</error>', Lang::get('failed_to_create')));
            $output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
        }
    }
983842
public static function make(CommandInterface $command, ProcessOutputInterface $outputHandler = null)
    {
        return new Process($command, null, $outputHandler);
    }
495302
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $logger = $this->getLogger();

        if (!$this->lock()) {
            $output->writeln('<comment>The command is already running in another process.</comment>');
            $logger->warning('Command is already running.');
        } else {
            try {
                $logger->info('Started export in command.');

                $orderVisitor = $this->getOrders();

                $this->getExporter()->exportOrders($orderVisitor, $this->getProgressBar($output, count($orderVisitor)));

                $logger->info('Finished export in command.');
            } catch (Exception $exc) {
                $logger->error('Stopped export in command.', ['exception' => $exc]);
            }
        }
    }
761302
public function execute(InputInterface $input, OutputInterface $output)
    {
        $runner = $this->commandDefinition->getRunner();
        $runner();
    }
799471
public function connectOutputToLogging(OutputInterface $output, $command)
    {
        static $alreadyConnected = false;
        $helper = $this;

        // ignore any second or later invocations of this method
        if ($alreadyConnected) {
            return;
        }

        /** @var Dispatcher $eventDispatcher  */
        $eventDispatcher = $command->getService('event_dispatcher');

        $eventDispatcher->addListener(
            'parser.file.pre',
            function (PreFileEvent $event) use ($output) {
                $output->writeln('Parsing <info>'.$event->getFile().'</info>');
            }
        );

        $eventDispatcher->addListener(
            'system.log',
            function (LogEvent $event) use ($command, $helper, $output) {
                $helper->logEvent($output, $event, $command);
            }
        );

        $alreadyConnected = true;
    }
632971
private function setInputAndOutput(InputInterface $input, OutputInterface $output)
    {
        if (is_null($this->assistant)) {
            $this->assistant = new CommandAssistant();
            $this->assistant->setQuestionHelper($this->getQuestionHelper());
            $this->assistant->setKernel($this->getApplication()->getKernel());
        }
        $this->assistant->setOutput($output);
        $this->assistant->setInput($input);
    }
246407
public function handle(SignupUserCommand $command)
    {
        $user = User::create([
            'username' => $command->username,
            'password' => $command->password,
            'email'    => $command->email,
            'level'    => User::LEVEL_USER,
        ]);

        event(new UserWasCreatedEvent($user));

        return $user;
    }
1120516
protected function executeCommand(Command $command, array $arguments, OutputInterface $output)
    {
        $output = clone $output;
        if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
            $output->setVerbosity($output->getVerbosity());
        } else {
            $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
        }

        return $command->run(new ArrayInput($arguments), $output);
    }
1266996
public function cmdUpdateUser()
    {
        $params = $this->getParam();

        if (empty($params[0]) || count($params) < 2) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        if (!is_numeric($params[0])) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        $this->setSubmitted(null, $params);
        $this->setSubmitted('update', $params[0]);
        $this->setSubmittedJson('data');

        $this->validateComponent('user', array('admin' => true));

        $this->updateUser($params[0]);
        $this->output();
    }
862069
protected function execute(InputInterface $input, OutputInterface $output)
	{
		$this->setupEnvironment('administrator', $input, $output);

		// Enable debug, so that JInstaller::install() throws exceptions on problems
		$this->joomla->setCfg('debug', 1);

		$installer = \JInstaller::getInstance();

		if ($installer->install($this->handleExtension($input, $output)))
		{
			$output->writeln($this->getExtensionInfo($installer));

			return 0;
		}
		else
		{
			$output->writeln('Installation failed due to unknown reason.');

			return 1;
		}
	}