123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- namespace OCA\Testing\AppInfo;
- use OCA\Testing\AlternativeHomeUserBackend;
- use OCA\Testing\Listener\GetDeclarativeSettingsValueListener;
- use OCA\Testing\Listener\RegisterDeclarativeSettingsListener;
- use OCA\Testing\Listener\SetDeclarativeSettingsValueListener;
- use OCA\Testing\Provider\FakeText2ImageProvider;
- use OCA\Testing\Provider\FakeTextProcessingProvider;
- use OCA\Testing\Provider\FakeTextProcessingProviderSync;
- use OCA\Testing\Provider\FakeTranslationProvider;
- use OCA\Testing\Settings\DeclarativeSettingsForm;
- use OCA\Testing\TaskProcessing\FakeContextWriteProvider;
- use OCA\Testing\TaskProcessing\FakeTextToImageProvider;
- use OCA\Testing\TaskProcessing\FakeTextToTextProvider;
- use OCA\Testing\TaskProcessing\FakeTextToTextSummaryProvider;
- use OCA\Testing\TaskProcessing\FakeTranscribeProvider;
- use OCA\Testing\TaskProcessing\FakeTranslateProvider;
- use OCP\AppFramework\App;
- use OCP\AppFramework\Bootstrap\IBootContext;
- use OCP\AppFramework\Bootstrap\IBootstrap;
- use OCP\AppFramework\Bootstrap\IRegistrationContext;
- use OCP\Settings\Events\DeclarativeSettingsGetValueEvent;
- use OCP\Settings\Events\DeclarativeSettingsRegisterFormEvent;
- use OCP\Settings\Events\DeclarativeSettingsSetValueEvent;
- class Application extends App implements IBootstrap {
- public const APP_ID = 'testing';
- public function __construct(array $urlParams = []) {
- parent::__construct(self::APP_ID, $urlParams);
- }
- public function register(IRegistrationContext $context): void {
- $context->registerTranslationProvider(FakeTranslationProvider::class);
- $context->registerTextProcessingProvider(FakeTextProcessingProvider::class);
- $context->registerTextProcessingProvider(FakeTextProcessingProviderSync::class);
- $context->registerTextToImageProvider(FakeText2ImageProvider::class);
- $context->registerTaskProcessingProvider(FakeTextToTextProvider::class);
- $context->registerTaskProcessingProvider(FakeTextToTextSummaryProvider::class);
- $context->registerTaskProcessingProvider(FakeTextToImageProvider::class);
- $context->registerTaskProcessingProvider(FakeTranslateProvider::class);
- $context->registerTaskProcessingProvider(FakeTranscribeProvider::class);
- $context->registerTaskProcessingProvider(FakeContextWriteProvider::class);
- $context->registerDeclarativeSettings(DeclarativeSettingsForm::class);
- $context->registerEventListener(DeclarativeSettingsRegisterFormEvent::class, RegisterDeclarativeSettingsListener::class);
- $context->registerEventListener(DeclarativeSettingsGetValueEvent::class, GetDeclarativeSettingsValueListener::class);
- $context->registerEventListener(DeclarativeSettingsSetValueEvent::class, SetDeclarativeSettingsValueListener::class);
- }
- public function boot(IBootContext $context): void {
- $server = $context->getServerContainer();
- $config = $server->getConfig();
- if ($config->getAppValue(self::APP_ID, 'enable_alt_user_backend', 'no') === 'yes') {
- $userManager = $server->getUserManager();
-
- $userManager->clearBackends();
- $userManager->registerBackend($context->getAppContainer()->get(AlternativeHomeUserBackend::class));
- }
- }
- }
|