aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/provisioning_api/lib/Capabilities.php9
-rw-r--r--apps/provisioning_api/tests/CapabilitiesTest.php24
2 files changed, 21 insertions, 12 deletions
diff --git a/apps/provisioning_api/lib/Capabilities.php b/apps/provisioning_api/lib/Capabilities.php
index 59c462c5d90..835bbfe9b5c 100644
--- a/apps/provisioning_api/lib/Capabilities.php
+++ b/apps/provisioning_api/lib/Capabilities.php
@@ -41,20 +41,23 @@ class Capabilities implements ICapability {
* @return array Array containing the apps capabilities
*/
public function getCapabilities() {
- $federationScopesEnabled = false;
+ $federatedScopeEnabled = $this->appManager->isEnabledForUser('federation');
+
+ $publishedScopeEnabled = false;
$federatedFileSharingEnabled = $this->appManager->isEnabledForUser('federatedfilesharing');
if ($federatedFileSharingEnabled) {
/** @var FederatedShareProvider $shareProvider */
$shareProvider = \OC::$server->query(FederatedShareProvider::class);
- $federationScopesEnabled = $shareProvider->isLookupServerUploadEnabled();
+ $publishedScopeEnabled = $shareProvider->isLookupServerUploadEnabled();
}
return [
'provisioning_api' => [
'version' => $this->appManager->getAppVersion('provisioning_api'),
'AccountPropertyScopesVersion' => 2,
- 'AccountPropertyScopesFederationEnabled' => $federationScopesEnabled,
+ 'AccountPropertyScopesFederatedEnabled' => $federatedScopeEnabled,
+ 'AccountPropertyScopesPublishedEnabled' => $publishedScopeEnabled,
]
];
}
diff --git a/apps/provisioning_api/tests/CapabilitiesTest.php b/apps/provisioning_api/tests/CapabilitiesTest.php
index 97f9ba562bc..8fc29b442eb 100644
--- a/apps/provisioning_api/tests/CapabilitiesTest.php
+++ b/apps/provisioning_api/tests/CapabilitiesTest.php
@@ -57,20 +57,25 @@ class CapabilitiesTest extends TestCase {
public function getCapabilitiesProvider() {
return [
- [false, false, false],
- [true, false, false],
- [true, true, true],
+ [true, false, false, true, false],
+ [true, true, false, true, false],
+ [true, true, true, true, true],
+ [false, false, false, false, false],
+ [false, true, false, false, false],
+ [false, true, true, false, true],
];
}
/**
* @dataProvider getCapabilitiesProvider
*/
- public function testGetCapabilities($federationAppEnabled, $lookupServerEnabled, $expectedFederationScopesEnabled) {
- $this->appManager->expects($this->once())
- ->method('isEnabledForUser')
- ->with('federatedfilesharing')
- ->willReturn($federationAppEnabled);
+ public function testGetCapabilities($federationAppEnabled, $federatedFileSharingAppEnabled, $lookupServerEnabled, $expectedFederatedScopeEnabled, $expectedPublishedScopeEnabled) {
+ $this->appManager->expects($this->any())
+ ->method('isEnabledForUser')
+ ->will($this->returnValueMap([
+ ['federation', null, $federationAppEnabled],
+ ['federatedfilesharing', null, $federatedFileSharingAppEnabled],
+ ]));
$federatedShareProvider = $this->createMock(FederatedShareProvider::class);
$this->overwriteService(FederatedShareProvider::class, $federatedShareProvider);
@@ -83,7 +88,8 @@ class CapabilitiesTest extends TestCase {
'provisioning_api' => [
'version' => '1.12',
'AccountPropertyScopesVersion' => 2,
- 'AccountPropertyScopesFederationEnabled' => $expectedFederationScopesEnabled,
+ 'AccountPropertyScopesFederatedEnabled' => $expectedFederatedScopeEnabled,
+ 'AccountPropertyScopesPublishedEnabled' => $expectedPublishedScopeEnabled,
],
];
$this->assertSame($expected, $this->capabilities->getCapabilities());