add setting to enable/disable federated group sharing
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
parent
a22bc0e787
commit
c8631d607e
|
@ -30,6 +30,7 @@
|
|||
namespace OCA\FederatedFileSharing;
|
||||
|
||||
use OC\Share20\Share;
|
||||
use OCP\Federation\ICloudFederationProviderManager;
|
||||
use OCP\Federation\ICloudIdManager;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\Files\Folder;
|
||||
|
@ -92,6 +93,9 @@ class FederatedShareProvider implements IShareProvider {
|
|||
/** @var \OCP\GlobalScale\IConfig */
|
||||
private $gsConfig;
|
||||
|
||||
/** @var ICloudFederationProviderManager */
|
||||
private $cloudFederationProviderManager;
|
||||
|
||||
/**
|
||||
* DefaultShareProvider constructor.
|
||||
*
|
||||
|
@ -106,6 +110,7 @@ class FederatedShareProvider implements IShareProvider {
|
|||
* @param IUserManager $userManager
|
||||
* @param ICloudIdManager $cloudIdManager
|
||||
* @param \OCP\GlobalScale\IConfig $globalScaleConfig
|
||||
* @param ICloudFederationProviderManager $cloudFederationProviderManager
|
||||
*/
|
||||
public function __construct(
|
||||
IDBConnection $connection,
|
||||
|
@ -118,7 +123,8 @@ class FederatedShareProvider implements IShareProvider {
|
|||
IConfig $config,
|
||||
IUserManager $userManager,
|
||||
ICloudIdManager $cloudIdManager,
|
||||
\OCP\GlobalScale\IConfig $globalScaleConfig
|
||||
\OCP\GlobalScale\IConfig $globalScaleConfig,
|
||||
ICloudFederationProviderManager $cloudFederationProviderManager
|
||||
) {
|
||||
$this->dbConnection = $connection;
|
||||
$this->addressHandler = $addressHandler;
|
||||
|
@ -131,6 +137,7 @@ class FederatedShareProvider implements IShareProvider {
|
|||
$this->userManager = $userManager;
|
||||
$this->cloudIdManager = $cloudIdManager;
|
||||
$this->gsConfig = $globalScaleConfig;
|
||||
$this->cloudFederationProviderManager = $cloudFederationProviderManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -967,6 +974,42 @@ class FederatedShareProvider implements IShareProvider {
|
|||
return ($result === 'yes');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* check if users from other Nextcloud instances are allowed to send federated group shares
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isOutgoingServer2serverGroupShareEnabled() {
|
||||
if ($this->gsConfig->onlyInternalFederation()) {
|
||||
return false;
|
||||
}
|
||||
$result = $this->config->getAppValue('files_sharing', 'outgoing_server2server_group_share_enabled', 'no');
|
||||
return ($result === 'yes');
|
||||
}
|
||||
|
||||
/**
|
||||
* check if users are allowed to receive federated group shares
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isIncomingServer2serverGroupShareEnabled() {
|
||||
if ($this->gsConfig->onlyInternalFederation()) {
|
||||
return false;
|
||||
}
|
||||
$result = $this->config->getAppValue('files_sharing', 'incoming_server2server_group_share_enabled', 'no');
|
||||
return ($result === 'yes');
|
||||
}
|
||||
|
||||
/**
|
||||
* check if federated group sharing is supported, therefore the OCM API need to be enabled
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isFederatedGroupSharingSupported() {
|
||||
return $this->cloudFederationProviderManager->isReady();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if querying sharees on the lookup server is enabled
|
||||
*
|
||||
|
|
|
@ -58,6 +58,9 @@ class Admin implements ISettings {
|
|||
'internalOnly' => $this->gsConfig->onlyInternalFederation(),
|
||||
'outgoingServer2serverShareEnabled' => $this->fedShareProvider->isOutgoingServer2serverShareEnabled(),
|
||||
'incomingServer2serverShareEnabled' => $this->fedShareProvider->isIncomingServer2serverShareEnabled(),
|
||||
'federatedGroupSharingSupported' => $this->fedShareProvider->isFederatedGroupSharingSupported(),
|
||||
'outgoingServer2serverGroupShareEnabled' => $this->fedShareProvider->isOutgoingServer2serverGroupShareEnabled(),
|
||||
'incomingServer2serverGroupShareEnabled' => $this->fedShareProvider->isIncomingServer2serverGroupShareEnabled(),
|
||||
'lookupServerEnabled' => $this->fedShareProvider->isLookupServerQueriesEnabled(),
|
||||
'lookupServerUploadEnabled' => $this->fedShareProvider->isLookupServerUploadEnabled(),
|
||||
];
|
||||
|
|
|
@ -23,7 +23,6 @@ script('federatedfilesharing', 'settings-admin');
|
|||
<?php p($l->t('Allow users on this server to send shares to other servers'));?>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="checkbox" name="incoming_server2server_share_enabled" id="incomingServer2serverShareEnabled" class="checkbox"
|
||||
value="1" <?php if ($_['incomingServer2serverShareEnabled']) print_unescaped('checked="checked"'); ?> />
|
||||
|
@ -31,6 +30,22 @@ script('federatedfilesharing', 'settings-admin');
|
|||
<?php p($l->t('Allow users on this server to receive shares from other servers'));?>
|
||||
</label><br/>
|
||||
</p>
|
||||
<?php if($_['federatedGroupSharingSupported']): ?>
|
||||
<p>
|
||||
<input type="checkbox" name="outgoing_server2server_group_share_enabled" id="outgoingServer2serverGroupShareEnabled" class="checkbox"
|
||||
value="1" <?php if ($_['outgoingServer2serverGroupShareEnabled']) print_unescaped('checked="checked"'); ?> />
|
||||
<label for="outgoingServer2serverGroupShareEnabled">
|
||||
<?php p($l->t('Allow users on this server to send shares to groups on other servers'));?>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<input type="checkbox" name="incoming_server2server_group_share_enabled" id="incomingServer2serverGroupShareEnabled" class="checkbox"
|
||||
value="1" <?php if ($_['incomingServer2serverGroupShareEnabled']) print_unescaped('checked="checked"'); ?> />
|
||||
<label for="incomingServer2serverGroupShareEnabled">
|
||||
<?php p($l->t('Allow users on this server to receive group shares from other servers'));?>
|
||||
</label><br/>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<p>
|
||||
<input type="checkbox" name="lookupServerEnabled" id="lookupServerEnabled" class="checkbox"
|
||||
value="1" <?php if ($_['lookupServerEnabled']) print_unescaped('checked="checked"'); ?> />
|
||||
|
|
Loading…
Reference in New Issue