N98\Magento\Command\Admin\User\LockCommand::execute PHP Method

execute() protected method

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output ) : void
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
return void
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->detectMagento($output, true);
        if (!$this->initMagento()) {
            return;
        }
        $username = $input->getArgument('username');
        $lifetime = $input->getArgument('lifetime') ?: $this->daysToSeconds(self::LIFETIME_DEFAULT);
        $user = \Mage::getModel('admin/user')->loadByUsername($username);
        if (!$user || !$user->getId()) {
            $output->writeln("<error>Couldn't find admin username '{$username}'</error>");
            return;
        }
        \Mage::getResourceModel('enterprise_pci/admin_user')->lock($user->getId(), 0, $lifetime);
        $lifetimeMessage = '';
        if ($input->getArgument('lifetime')) {
            $lifetimeMessage = sprintf(' for %d days.', $input->getArgument('lifetime'));
        }
        $output->writeln(sprintf('<info><comment>%s</comment> locked%s</info>', $username, $lifetimeMessage));
    }