Skip to content

Commit

Permalink
Fix IShareProvider initialization for DAV
Browse files Browse the repository at this point in the history
  • Loading branch information
smesterheide committed Oct 17, 2022
1 parent 200fbff commit e55f2e6
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion lib/private/Share20/ProviderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class ProviderFactory implements IProviderFactory {
private $circlesAreNotAvailable = false;
/** @var \OCA\Talk\Share\RoomShareProvider */
private $roomShareProvider = null;
/** @var \OCA\VO_Federation\FederatedGroupShareProvider */
private $federatedGroupShareProvider = null;

private $registeredShareProviders = [];

Expand Down Expand Up @@ -267,6 +269,31 @@ protected function getRoomShareProvider() {
return $this->roomShareProvider;
}

/**
* Create the federated group share provider
*
* @return FederatedGroupShareProvider
*/
protected function getFederatedGroupShareProvider() {
if ($this->federatedGroupShareProvider === null) {
/*
* Check if the app is enabled
*/
$appManager = $this->serverContainer->getAppManager();
if (!$appManager->isEnabledForUser('vo_federation')) {
return null;
}

try {
$this->federatedGroupShareProvider = $this->serverContainer->query('\OCA\VO_Federation\FederatedGroupShareProvider');
} catch (\OCP\AppFramework\QueryException $e) {
return null;
}
}

return $this->federatedGroupShareProvider;
}

/**
* @inheritdoc
*/
Expand All @@ -286,6 +313,8 @@ public function getProvider($id) {
$provider = $this->getShareByCircleProvider();
} elseif ($id === 'ocRoomShare') {
$provider = $this->getRoomShareProvider();
} elseif ($id === 'ocFederatedGroupShare') {
$provider = $this->getFederatedGroupShareProvider();
}

foreach ($this->registeredShareProviders as $shareProvider) {
Expand Down Expand Up @@ -327,7 +356,7 @@ public function getProviderForType($shareType) {
} elseif ($shareType === IShare::TYPE_DECK) {
$provider = $this->getProvider('deck');
} elseif ($shareType === IShare::TYPE_FEDERATED_GROUP) {
$provider = $this->getProvider('federated_group');
$provider = $this->getFederatedGroupShareProvider();
}


Expand All @@ -352,6 +381,10 @@ public function getAllProviders() {
if ($roomShare !== null) {
$shares[] = $roomShare;
}
$federatedGroupShare = $this->getFederatedGroupShareProvider();
if ($federatedGroupShare !== null) {
$shares[] = $federatedGroupShare;
}

foreach ($this->registeredShareProviders as $shareProvider) {
/** @var IShareProvider $instance */
Expand Down

0 comments on commit e55f2e6

Please sign in to comment.