Browse Source

Do not allow transfer ownership when the user isn't the owner

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
tags/v19.0.0beta1
Christoph Wurst 4 years ago
parent
commit
68b764bb0f
No account linked to committer's email address

+ 2
- 2
apps/files/js/dist/personal-settings.js
File diff suppressed because it is too large
View File


+ 1
- 1
apps/files/js/dist/personal-settings.js.map
File diff suppressed because it is too large
View File


+ 4
- 0
apps/files/lib/Controller/TransferOwnershipController.php View File

@@ -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);

+ 5
- 1
apps/files/src/components/TransferOwnershipDialogue.vue View File

@@ -215,7 +215,11 @@ export default {
.catch(error => {
logger.error('Could not send ownership transfer request', { error })

this.submitError = error.message || t('files', 'Unknown 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…
Cancel
Save