diff --git a/lib/Capabilities.php b/lib/Capabilities.php index 079d1ebe8e..8fc75fe60d 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -23,6 +23,7 @@ namespace OCA\Richdocuments; +use OCP\App\IAppManager; use OCA\Richdocuments\Service\CapabilitiesService; use OCP\Capabilities\ICapability; use OCP\IL10N; @@ -82,14 +83,17 @@ class Capabilities implements ICapability { private $capabilitiesService; /** @var PermissionManager */ private $permissionManager; + /** @var IAppManager */ + private $appManager; private $capabilities = null; - public function __construct(IL10N $l10n, AppConfig $config, CapabilitiesService $capabilitiesService, PermissionManager $permissionManager) { + public function __construct(IL10N $l10n, AppConfig $config, CapabilitiesService $capabilitiesService, PermissionManager $permissionManager, IAppManager $appManager) { $this->l10n = $l10n; $this->config = $config; $this->capabilitiesService = $capabilitiesService; $this->permissionManager = $permissionManager; + $this->appManager = $appManager; } public function getCapabilities() { @@ -108,6 +112,10 @@ public function getCapabilities() { ]); } + if (!$this->appManager->isEnabledForUser('files_pdfviewer')) { + $filteredMimetypes[] = 'application/pdf'; + } + $this->capabilities = [ 'richdocuments' => [ 'version' => \OC::$server->getAppManager()->getAppVersion('richdocuments'),