Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #40966 #40967

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 29 additions & 0 deletions apps/files_sharing/lib/Controller/RemoteOcsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,25 @@ public function acceptShare($id) {
);
}

// Allow the Federated Groups app to overwrite the behaviour of this endpoint
$managerClass = $this->config->getSystemValue('sharing.groupExternalManager');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some duplication getting the external manager. We can move that piece of code in a private method in order to reduce the duplication. I think this also affects to some code in this class not present in this PR.

if (!empty($managerClass)) {
$groupExternalManager = \OC::$server->query($managerClass);

if ($groupExternalManager->acceptShare((int) $id)) {
$share = $groupExternalManager->getShare($id);
// Frontend part expects a list of accepted shares having state and mountpoint at least
return new Result(
[
[
'state' => Share::STATE_ACCEPTED,
'file_target' => $share['mountpoint']
]
]
);
}
}

// Make sure the user has no notification for something that does not exist anymore.
$this->externalManager->processNotification((int) $id);

Expand All @@ -129,6 +148,16 @@ public function declineShare($id) {
return new Result();
}

// Allow the Federated Groups app to overwrite the behaviour of this endpoint
$managerClass = $this->config->getSystemValue('sharing.groupExternalManager');
if (!empty($managerClass)) {
$groupExternalManager = \OC::$server->query($managerClass);

if ($groupExternalManager->declineShare((int) $id)) {
return new Result();
}
}

// Make sure the user has no notification for something that does not exist anymore.
$this->externalManager->processNotification((int) $id);

Expand Down