registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); $context->registerService(NewUserMailHelper::class, function (ContainerInterface $c) { return new NewUserMailHelper( $c->get(Defaults::class), $c->get(IURLGenerator::class), $c->get(IFactory::class), $c->get(IMailer::class), $c->get(ISecureRandom::class), $c->get(ITimeFactory::class), $c->get(IConfig::class), $c->get(ICrypto::class), Util::getDefaultEmailAddress('no-reply') ); }); $context->registerService(ProvisioningApiMiddleware::class, function (ContainerInterface $c) { $user = $c->get(IUserManager::class)->get($c->get('UserId')); $isAdmin = false; $isSubAdmin = false; if ($user instanceof IUser) { $groupManager = $c->get(IGroupManager::class); assert($groupManager instanceof GroupManager); $isAdmin = $groupManager->isAdmin($user->getUID()); $isSubAdmin = $groupManager->getSubAdmin()->isSubAdmin($user); } return new ProvisioningApiMiddleware( $c->get(IControllerMethodReflector::class), $isAdmin, $isSubAdmin ); }); $context->registerMiddleware(ProvisioningApiMiddleware::class); $context->registerCapability(Capabilities::class); } public function boot(IBootContext $context): void { } }