|
|
@ -7,9 +7,11 @@ |
|
|
|
*/ |
|
|
|
namespace OC\OCS; |
|
|
|
|
|
|
|
use OCP\App\IAppManager; |
|
|
|
use OCP\Capabilities\ICapability; |
|
|
|
use OCP\IConfig; |
|
|
|
use OCP\IURLGenerator; |
|
|
|
use OCP\IUserSession; |
|
|
|
|
|
|
|
/** |
|
|
|
* Class Capabilities |
|
|
@ -22,6 +24,8 @@ class CoreCapabilities implements ICapability { |
|
|
|
*/ |
|
|
|
public function __construct( |
|
|
|
private IConfig $config, |
|
|
|
private IAppManager $appManager, |
|
|
|
private IUserSession $userSession, |
|
|
|
) { |
|
|
|
} |
|
|
|
|
|
|
@ -35,11 +39,12 @@ class CoreCapabilities implements ICapability { |
|
|
|
* reference-api: boolean, |
|
|
|
* reference-regex: string, |
|
|
|
* mod-rewrite-working: boolean, |
|
|
|
* enabled-apps: list<string>, |
|
|
|
* }, |
|
|
|
* } |
|
|
|
*/ |
|
|
|
public function getCapabilities(): array { |
|
|
|
return [ |
|
|
|
$capabilities = [ |
|
|
|
'core' => [ |
|
|
|
'pollinterval' => $this->config->getSystemValueInt('pollinterval', 60), |
|
|
|
'webdav-root' => $this->config->getSystemValueString('webdav-root', 'remote.php/webdav'), |
|
|
@ -48,5 +53,14 @@ class CoreCapabilities implements ICapability { |
|
|
|
'mod-rewrite-working' => $this->config->getSystemValueBool('htaccess.IgnoreFrontController') || getenv('front_controller_active') === 'true', |
|
|
|
], |
|
|
|
]; |
|
|
|
|
|
|
|
$user = $this->userSession->getUser(); |
|
|
|
if ($user === null) { |
|
|
|
$capabilities['core']['enabled-apps'] = $this->appManager->getEnabledApps(); |
|
|
|
} else { |
|
|
|
$capabilities['core']['enabled-apps'] = $this->appManager->getEnabledAppsForUser($user); |
|
|
|
} |
|
|
|
|
|
|
|
return $capabilities; |
|
|
|
} |
|
|
|
} |