Improve federated permission handling

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2021-04-26 14:15:00 +02:00 committed by backportbot[bot]
parent 0cb66c5ca0
commit 9501514055
1 changed files with 2 additions and 18 deletions

View File

@ -31,6 +31,7 @@ namespace OCA\FederatedFileSharing\OCM;
use OC\AppFramework\Http; use OC\AppFramework\Http;
use OC\Files\Filesystem; use OC\Files\Filesystem;
use OC\HintException;
use OCA\FederatedFileSharing\AddressHandler; use OCA\FederatedFileSharing\AddressHandler;
use OCA\FederatedFileSharing\FederatedShareProvider; use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\Files_Sharing\Activity\Providers\RemoteShares; use OCA\Files_Sharing\Activity\Providers\RemoteShares;
@ -678,24 +679,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
* @throws BadRequestException * @throws BadRequestException
*/ */
protected function updateResharePermissions($id, array $notification) { protected function updateResharePermissions($id, array $notification) {
if (!isset($notification['sharedSecret'])) { throw new HintException('Updating reshares not allowed');
throw new BadRequestException(['sharedSecret']);
}
$token = $notification['sharedSecret'];
if (!isset($notification['permission'])) {
throw new BadRequestException(['permission']);
}
$ocmPermissions = $notification['permission'];
$share = $this->federatedShareProvider->getShareById($id);
$ncPermission = $this->ocmPermissions2ncPermissions($ocmPermissions);
$this->verifyShare($share, $token);
$this->updatePermissionsInDatabase($share, $ncPermission);
return [];
} }
/** /**