Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f88723e8 authored by Akhil's avatar Akhil 🙂
Browse files

use a named parameter in query builder expression

parent 8aa11af1
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ declare(strict_types=1);

namespace OCA\EcloudAccounts\Command;

use OCA\EcloudAccounts\AppInfo\Application;
use OCA\EcloudAccounts\Db\TwoFactorMapper;
use OCA\EcloudAccounts\Service\SSOService;
use Symfony\Component\Console\Command\Command;
@@ -24,7 +25,7 @@ class Migrate2FASecrets extends Command {

	protected function configure(): void {
		$this
			->setName('ecloud-accounts:migrate-2fa-secrets')
			->setName(Application::APP_ID . ':migrate-2fa-secrets')
			->setDescription('Migrates 2FA secrets to SSO database')
			->addOption(
				'users',
+5 −1
Original line number Diff line number Diff line
@@ -19,7 +19,11 @@ class TwoFactorMapper {
		$qb = $this->conn->getQueryBuilder();
		$qb->select('user_id', 'secret')
			->from(self::TOTP_SECRET_TABLE)
			->where($qb->expr()->eq($qb->expr()->castColumn('state', IQueryBuilder::PARAM_INT), ITotp::STATE_ENABLED));
			->where(
				$qb->expr()->eq(
					'state', $qb->createNamedParameter(ITotp::STATE_ENABLED)
				)
			);

		if (!empty($usernames)) {
			$qb->andWhere('user_id IN (:usernames)')