mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
feat(users): Check assertion when enabling user
Signed-off-by: Louis Chmn <louis@chmn.me>
This commit is contained in:
parent
78ddc9da01
commit
4f531672bd
1 changed files with 10 additions and 1 deletions
|
|
@ -25,6 +25,7 @@ use OCP\IURLGenerator;
|
|||
use OCP\IUser;
|
||||
use OCP\IUserBackend;
|
||||
use OCP\Notification\IManager as INotificationManager;
|
||||
use OCP\Support\Subscription\IAssertion;
|
||||
use OCP\User\Backend\IGetHomeBackend;
|
||||
use OCP\User\Backend\IPasswordHashBackend;
|
||||
use OCP\User\Backend\IProvideAvatarBackend;
|
||||
|
|
@ -48,6 +49,7 @@ class User implements IUser {
|
|||
|
||||
private IConfig $config;
|
||||
private IURLGenerator $urlGenerator;
|
||||
private IAssertion $assertion;
|
||||
|
||||
/** @var IAccountManager */
|
||||
protected $accountManager;
|
||||
|
|
@ -76,11 +78,13 @@ class User implements IUser {
|
|||
private IEventDispatcher $dispatcher,
|
||||
$emitter = null,
|
||||
?IConfig $config = null,
|
||||
$urlGenerator = null,
|
||||
?IURLGenerator $urlGenerator = null,
|
||||
?IAssertion $assertion = null,
|
||||
) {
|
||||
$this->emitter = $emitter;
|
||||
$this->config = $config ?? \OCP\Server::get(IConfig::class);
|
||||
$this->urlGenerator = $urlGenerator ?? \OCP\Server::get(IURLGenerator::class);
|
||||
$this->assertion = $assertion ?? \OCP\Server::get(IAssertion::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -484,6 +488,11 @@ class User implements IUser {
|
|||
$this->config->setUserValue($this->uid, 'core', 'enabled', $enabled ? 'true' : 'false');
|
||||
$this->enabled = $enabled;
|
||||
};
|
||||
|
||||
if ($oldStatus === false && $enabled === true) {
|
||||
$this->assertion->createUserIsLegit();
|
||||
}
|
||||
|
||||
if ($this->backend instanceof IProvideEnabledStateBackend) {
|
||||
$queryDatabaseValue = function (): bool {
|
||||
if ($this->enabled === null) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue