fix: user can only delete own external storage#41092
Conversation
|
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
62f9933 to
16acc12
Compare
| ->addParameters([ | ||
| (new DefinitionParameter('datadir', $l->t('Location'))), | ||
| ]) | ||
| ->setAllowedVisibility(IStoragesBackendService::VISIBILITY_ADMIN) |
7d84892 to
3c7bc6e
Compare
| }, $optionsMap); | ||
| } | ||
|
|
||
| public function getPersonalMountById(int $mountId, string $userId): ?array { |
There was a problem hiding this comment.
We might need some PHPDoc, specially to explain the return value. I guess it will return the whole row, but it could also return part of it, or a different information based on the row, maybe including extra information.
In addition, in the weird case of matching multiple rows, it will return the first matched row. There could be other options such as returning null (can't decide the right row), or throwing an exception, so it would be nice to clarify. I guess the column has a unique key constraint, so it won't matter, but the count($mounts) > 0 seems to differ.
There was a problem hiding this comment.
It selects by id. There is one or none result.
| return $result; | ||
| } | ||
|
|
||
| public function removeStorage($id) { |
There was a problem hiding this comment.
PHPDoc would be fine, specially no note that the storage will only be looked for as personal mount of the user, so the method will throw a NotFoundException if the id isn't one of his personal mount points, even if the id exists somewhere else.
There was a problem hiding this comment.
Yeah. The whole code is a bit nuts.
Docs could help for the next dev looking at this in a few years 🤣
3c7bc6e to
891f4aa
Compare
891f4aa to
2d85873
Compare
|
Failing drone is unrelated ... |
|
Kudos, SonarCloud Quality Gate passed! |








Description
Ensure that users can only delete their own external storage configurations.
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: