2626use OCP \IUser ;
2727use OCP \IUserBackend ;
2828use OCP \Notification \IManager as INotificationManager ;
29+ use OCP \Support \Subscription \IAssertion ;
2930use OCP \User \Backend \IGetHomeBackend ;
3031use OCP \User \Backend \IPasswordHashBackend ;
3132use OCP \User \Backend \IProvideAvatarBackend ;
@@ -49,6 +50,7 @@ class User implements IUser {
4950
5051 private IConfig $ config ;
5152 private IURLGenerator $ urlGenerator ;
53+ private IAssertion $ assertion ;
5254
5355 /** @var IAccountManager */
5456 protected $ accountManager ;
@@ -77,11 +79,13 @@ public function __construct(
7779 private IEventDispatcher $ dispatcher ,
7880 $ emitter = null ,
7981 ?IConfig $ config = null ,
80- $ urlGenerator = null ,
82+ ?IURLGenerator $ urlGenerator = null ,
83+ ?IAssertion $ assertion = null ,
8184 ) {
8285 $ this ->emitter = $ emitter ;
8386 $ this ->config = $ config ?? \OCP \Server::get (IConfig::class);
8487 $ this ->urlGenerator = $ urlGenerator ?? \OCP \Server::get (IURLGenerator::class);
88+ $ this ->assertion = $ assertion ?? \OCP \Server::get (IAssertion::class);
8589 }
8690
8791 /**
@@ -466,6 +470,11 @@ public function setEnabled(bool $enabled = true) {
466470 $ this ->config ->setUserValue ($ this ->uid , 'core ' , 'enabled ' , $ enabled ? 'true ' : 'false ' );
467471 $ this ->enabled = $ enabled ;
468472 };
473+
474+ if ($ oldStatus === false && $ enabled === true ) {
475+ $ this ->assertion ->createUserIsLegit ();
476+ }
477+
469478 if ($ this ->backend instanceof IProvideEnabledStateBackend) {
470479 $ queryDatabaseValue = function (): bool {
471480 if ($ this ->enabled === null ) {
0 commit comments