Merge pull request #19764 from nextcloud/fix/transfer-ownerhip-owner-check
Do not allow transfer ownership when the user isn't the owner
This commit is contained in:
commit
65b75c8bba
4 changed files with 9 additions and 1 deletions
BIN
apps/files/js/dist/personal-settings.js
vendored
BIN
apps/files/js/dist/personal-settings.js
vendored
Binary file not shown.
BIN
apps/files/js/dist/personal-settings.js.map
vendored
BIN
apps/files/js/dist/personal-settings.js.map
vendored
Binary file not shown.
|
@ -96,6 +96,10 @@ class TransferOwnershipController extends OCSController {
|
|||
return new DataResponse([], Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
|
||||
if ($node->getOwner()->getUID() !== $this->userId) {
|
||||
return new DataResponse([], Http::STATUS_FORBIDDEN);
|
||||
}
|
||||
|
||||
$transferOwnership = new TransferOwnershipEntity();
|
||||
$transferOwnership->setSourceUser($this->userId);
|
||||
$transferOwnership->setTargetUser($recipient);
|
||||
|
|
|
@ -215,7 +215,11 @@ export default {
|
|||
.catch(error => {
|
||||
logger.error('Could not send ownership transfer request', { error })
|
||||
|
||||
if (error?.response?.status === 403) {
|
||||
this.submitError = t('files', 'Cannot transfter ownership of a file or folder you don\'t own')
|
||||
} else {
|
||||
this.submitError = error.message || t('files', 'Unknown error')
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue