2525use OCP \IUser ;
2626use OCP \IUserBackend ;
2727use OCP \Notification \IManager as INotificationManager ;
28+ use OCP \Support \Subscription \IAssertion ;
2829use OCP \User \Backend \IGetHomeBackend ;
2930use OCP \User \Backend \IPasswordHashBackend ;
3031use OCP \User \Backend \IProvideAvatarBackend ;
@@ -48,6 +49,7 @@ class User implements IUser {
4849
4950 private IConfig $ config ;
5051 private IURLGenerator $ urlGenerator ;
52+ private IAssertion $ assertion ;
5153
5254 /** @var IAccountManager */
5355 protected $ accountManager ;
@@ -76,11 +78,13 @@ public function __construct(
7678 private IEventDispatcher $ dispatcher ,
7779 $ emitter = null ,
7880 ?IConfig $ config = null ,
79- $ urlGenerator = null ,
81+ ?IURLGenerator $ urlGenerator = null ,
82+ ?IAssertion $ assertion = null ,
8083 ) {
8184 $ this ->emitter = $ emitter ;
8285 $ this ->config = $ config ?? \OCP \Server::get (IConfig::class);
8386 $ this ->urlGenerator = $ urlGenerator ?? \OCP \Server::get (IURLGenerator::class);
87+ $ this ->assertion = $ assertion ?? \OCP \Server::get (IAssertion::class);
8488 }
8589
8690 /**
@@ -484,6 +488,11 @@ public function setEnabled(bool $enabled = true) {
484488 $ this ->config ->setUserValue ($ this ->uid , 'core ' , 'enabled ' , $ enabled ? 'true ' : 'false ' );
485489 $ this ->enabled = $ enabled ;
486490 };
491+
492+ if ($ oldStatus === false && $ enabled === true ) {
493+ $ this ->assertion ->createUserIsLegit ();
494+ }
495+
487496 if ($ this ->backend instanceof IProvideEnabledStateBackend) {
488497 $ queryDatabaseValue = function (): bool {
489498 if ($ this ->enabled === null ) {
0 commit comments