Skip to content

Commit

Permalink
Adds constructor to the Based class.
Browse files Browse the repository at this point in the history
Based on:
nextcloud#38775 (comment)

Signed-off-by: Faraz Samapoor <[email protected]>
  • Loading branch information
Faraz Samapoor authored and artonge committed Jun 20, 2023
1 parent 00a3a4f commit 147365a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
7 changes: 6 additions & 1 deletion core/Command/TwoFactorAuth/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;

class Base extends \OC\Core\Command\Base {
protected IUserManager $userManager;
public function __construct(
?string $name,
protected IUserManager $userManager,
) {
parent::__construct($name);
}

/**
* Return possible values for the named option
Expand Down
11 changes: 9 additions & 2 deletions core/Command/TwoFactorAuth/Cleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,20 @@
namespace OC\Core\Command\TwoFactorAuth;

use OCP\Authentication\TwoFactorAuth\IRegistry;
use OCP\IUserManager;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class Cleanup extends Base {
public function __construct(private IRegistry $registry) {
parent::__construct();
public function __construct(
private IRegistry $registry,
protected IUserManager $userManager,
) {
parent::__construct(
null,
$userManager,
);
}

protected function configure() {
Expand Down
5 changes: 4 additions & 1 deletion core/Command/TwoFactorAuth/Disable.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ public function __construct(
private ProviderManager $manager,
protected IUserManager $userManager,
) {
parent::__construct('twofactorauth:disable');
parent::__construct(
'twofactorauth:disable',
$userManager,
);
}

protected function configure() {
Expand Down
5 changes: 4 additions & 1 deletion core/Command/TwoFactorAuth/Enable.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ public function __construct(
private ProviderManager $manager,
protected IUserManager $userManager,
) {
parent::__construct('twofactorauth:enable');
parent::__construct(
'twofactorauth:enable',
$userManager,
);
}

protected function configure() {
Expand Down
5 changes: 4 additions & 1 deletion core/Command/TwoFactorAuth/State.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ public function __construct(
private IRegistry $registry,
protected IUserManager $userManager,
) {
parent::__construct('twofactorauth:state');
parent::__construct(
'twofactorauth:state',
$userManager,
);
}

protected function configure() {
Expand Down

0 comments on commit 147365a

Please sign in to comment.