Skip to content

Commit

Permalink
fix: allow users to only update own external storage configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDiver1975 committed Mar 25, 2024
1 parent b77fe84 commit ff679a6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/private/Files/External/Service/UserStoragesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ public function addStorage(IStorageConfig $newStorage) {
* @throws NotFoundException if the given storage does not exist in the config
*/
public function updateStorage(IStorageConfig $updatedStorage) {
$id = $updatedStorage->getId();
$mount = $this->dbConfig->getPersonalMountById($id, $this->getUser()->getUID());
if (!\is_array($mount)) {
throw new NotFoundException('Storage with id "' . $id . '" not found');
}

$updatedStorage->setApplicableUsers([$this->getUser()->getUID()]);
return parent::updateStorage($updatedStorage);
}
Expand Down

0 comments on commit ff679a6

Please sign in to comment.