Skip to content

Commit

Permalink
Rely on config and DI rather than specific app names
Browse files Browse the repository at this point in the history
  • Loading branch information
michielbdejong committed Apr 12, 2023
1 parent cff3289 commit ea01c1d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
18 changes: 10 additions & 8 deletions apps/federatedfilesharing/lib/Controller/OcmController.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,11 @@ public function createShare(
$resourceType,
$protocol
) {
// Allow the Federated Groups app to overwrite the behaviour of this endpoint (but only for group shares)
if (\OC::$server->getAppManager()->isEnabledForUser('federatedgroups') && ($shareType === 'group')) {
$controller = \OCA\FederatedGroups\Application::getOcmController($this->request);
return $controller->createShare(
// Allow other apps to overwrite the behaviour of this endpoint
$controllerClass = $this->config->getSystemValue('sharing.ocmController');
if ($controllerClass !== '') {
$controller = \OC::$server->query($controllerClass);
return $controller->createShare(
$shareWith,
$name,
$description,
Expand Down Expand Up @@ -301,10 +302,11 @@ public function processNotification(
$providerId,
$notification
) {
// Allow the Federated Groups app to overwrite the behaviour of this endpoint
if (\OC::$server->getAppManager()->isEnabledForUser('federatedgroups')) {
$controller = \OCA\FederatedGroups\Application::getOcmController($this->request);
return $controller->processNotification(
// Allow other apps to overwrite the behaviour of this endpoint
$controllerClass = $this->config->getSystemValue('sharing.ocmController');
if ($controllerClass !== '') {
$controller = \OC::$server->query($controllerClass);
return $controller->processNotification(
$notificationType,
$resourceType,
$providerId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
* @package OCA\Files_Sharing\Controllers
*/
class ExternalSharesController extends Controller {

/** @var \OCA\Files_Sharing\External\Manager */
private $externalManager;
/** @var \OCA\Files_Sharing\External\Manager */
Expand Down Expand Up @@ -71,8 +70,10 @@ public function __construct(
$this->externalManager = $externalManager;
$this->clientService = $clientService;
$this->dispatcher = $eventDispatcher;
if (\OC::$server->getAppManager()->isEnabledForUser('federatedgroups')) {
$this->groupExternalManager = \OCA\FederatedGroups\Application::getExternalManager();
// Allow other apps to add an external manager for user-to-group shares
$managerClass = $this->config->getSystemValue('sharing.groupExternalManager');
if ($managerClass !== '') {
$this->groupExternalManager = \OC::$server->query($managerClass);
}
}

Expand Down

0 comments on commit ea01c1d

Please sign in to comment.