12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- declare(strict_types=1);
- namespace OCA\UserStatus\AppInfo;
- use OCA\UserStatus\Capabilities;
- use OCA\UserStatus\Connector\UserStatusProvider;
- use OCA\UserStatus\Dashboard\UserStatusWidget;
- use OCA\UserStatus\Listener\BeforeTemplateRenderedListener;
- use OCA\UserStatus\Listener\OutOfOfficeStatusListener;
- use OCA\UserStatus\Listener\UserDeletedListener;
- use OCA\UserStatus\Listener\UserLiveStatusListener;
- use OCP\AppFramework\App;
- use OCP\AppFramework\Bootstrap\IBootContext;
- use OCP\AppFramework\Bootstrap\IBootstrap;
- use OCP\AppFramework\Bootstrap\IRegistrationContext;
- use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent;
- use OCP\IConfig;
- use OCP\User\Events\OutOfOfficeChangedEvent;
- use OCP\User\Events\OutOfOfficeClearedEvent;
- use OCP\User\Events\OutOfOfficeEndedEvent;
- use OCP\User\Events\OutOfOfficeScheduledEvent;
- use OCP\User\Events\OutOfOfficeStartedEvent;
- use OCP\User\Events\UserDeletedEvent;
- use OCP\User\Events\UserLiveStatusEvent;
- use OCP\UserStatus\IManager;
- class Application extends App implements IBootstrap {
-
- public const APP_ID = 'user_status';
-
- public function __construct(array $urlParams = []) {
- parent::__construct(self::APP_ID, $urlParams);
- }
-
- public function register(IRegistrationContext $context): void {
-
- $context->registerCapability(Capabilities::class);
-
- $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);
- $context->registerEventListener(UserLiveStatusEvent::class, UserLiveStatusListener::class);
- $context->registerEventListener(BeforeTemplateRenderedEvent::class, BeforeTemplateRenderedListener::class);
- $context->registerEventListener(OutOfOfficeChangedEvent::class, OutOfOfficeStatusListener::class);
- $context->registerEventListener(OutOfOfficeScheduledEvent::class, OutOfOfficeStatusListener::class);
- $context->registerEventListener(OutOfOfficeClearedEvent::class, OutOfOfficeStatusListener::class);
- $context->registerEventListener(OutOfOfficeStartedEvent::class, OutOfOfficeStatusListener::class);
- $context->registerEventListener(OutOfOfficeEndedEvent::class, OutOfOfficeStatusListener::class);
- $config = $this->getContainer()->query(IConfig::class);
- $shareeEnumeration = $config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes';
- $shareeEnumerationInGroupOnly = $shareeEnumeration && $config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_group', 'no') === 'yes';
- $shareeEnumerationPhone = $shareeEnumeration && $config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_phone', 'no') === 'yes';
-
- if ($shareeEnumeration && !$shareeEnumerationInGroupOnly && !$shareeEnumerationPhone) {
- $context->registerDashboardWidget(UserStatusWidget::class);
- }
- }
- public function boot(IBootContext $context): void {
-
- $userStatusManager = $context->getServerContainer()->get(IManager::class);
- $userStatusManager->registerProvider(UserStatusProvider::class);
- }
- }
|