add support for different share types
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
parent
e251b34a8c
commit
8d4da30bf5
|
@ -21,6 +21,7 @@
|
|||
|
||||
|
||||
namespace OCA\CloudFederationAPI;
|
||||
use OCP\Federation\ICloudFederationProviderManager;
|
||||
use OCP\GlobalScale\IConfig as IGsConfig;
|
||||
use OCP\IConfig;
|
||||
|
||||
|
@ -34,33 +35,23 @@ use OCP\IConfig;
|
|||
*/
|
||||
class Config {
|
||||
|
||||
/** @var IGsConfig */
|
||||
private $gsConfig;
|
||||
/** @var ICloudFederationProviderManager */
|
||||
private $cloudFederationProviderManager;
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
public function __construct(IGsConfig $globalScaleConfig, IConfig $config) {
|
||||
$this->gsConfig = $globalScaleConfig;
|
||||
$this->config = $config;
|
||||
public function __construct(ICloudFederationProviderManager $cloudFederationProviderManager) {
|
||||
$this->cloudFederationProviderManager = $cloudFederationProviderManager;
|
||||
}
|
||||
|
||||
public function incomingRequestsEnabled() {
|
||||
if ($this->gsConfig->onlyInternalFederation()) {
|
||||
return false;
|
||||
}
|
||||
$result = $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes');
|
||||
return ($result === 'yes');
|
||||
}
|
||||
|
||||
public function outgoingRequestsEnabled() {
|
||||
|
||||
if ($this->gsConfig->onlyInternalFederation()) {
|
||||
return false;
|
||||
}
|
||||
$result = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes');
|
||||
return ($result === 'yes');
|
||||
|
||||
/**
|
||||
* get a list of supported share types
|
||||
*
|
||||
* @param string $resourceType
|
||||
* @return array
|
||||
* @throws \OCP\Federation\Exceptions\ProviderDoesNotExistsException
|
||||
*/
|
||||
public function getSupportedShareTypes($resourceType) {
|
||||
$provider = $this->cloudFederationProviderManager->getCloudFederationProvider($resourceType);
|
||||
return $provider->getSupportedShareTypes();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -764,4 +764,14 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the supported share types, e.g. "user", "group", etc.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 14.0.0
|
||||
*/
|
||||
public function getSupportedShareTypes() {
|
||||
return ['user'];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,4 +77,13 @@ interface ICloudFederationProvider {
|
|||
*/
|
||||
public function notificationReceived($notificationType, $providerId, array $notification);
|
||||
|
||||
/**
|
||||
* get the supported share types, e.g. "user", "group", etc.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 14.0.0
|
||||
*/
|
||||
public function getSupportedShareTypes();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue