Merge pull request #26772 from nextcloud/backport/26763/stable19
[stable19] Improve federated permission handling
This commit is contained in:
commit
9f8d16b6f1
|
@ -28,6 +28,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;
|
||||||
|
@ -673,24 +674,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 [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue