-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add some additonal permission checks to the webdav backend #255
Conversation
3182f86
to
93c8458
Compare
Thanks, @schiessle. I'll see if I can write an integration test for this. |
... or even better: let @schiessle try to add this ;) |
Ah. I guess he'll be busy fixing the theming PR 🙈 |
Integration tests passed. They should pass, but there are some broken unit tests, @schiessle mind taking a look at those?
|
eae9b92
to
f43fba4
Compare
f43fba4
to
4e21543
Compare
$sourcePermission = $infoSource && $infoSource->isDeletable(); | ||
|
||
if (!$destinationPermission || !$sourcePermission) { | ||
throw new Forbidden(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required parameter $message missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Will fix myself)
Tests should pass now after ea18d86 |
@@ -285,7 +285,7 @@ public function copy($source, $destination) { | |||
|
|||
$info = $this->fileView->getFileInfo(dirname($destination)); | |||
if ($info && !$info->isUpdateable()) { | |||
throw new Forbidden(); | |||
throw new Forbidden('No permissions to move object.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"copy" in this case? 😉
Tested and works 👍 |
👍 for the tests |
@@ -273,6 +293,12 @@ public function copy($source, $destination) { | |||
throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup'); | |||
} | |||
|
|||
|
|||
$info = $this->fileView->getFileInfo(dirname($destination)); | |||
if ($info && !$info->isUpdateable()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might not be 100% correct. A copy needs create permissions for a "copy in" as new file.
As for "copy + overwrite" it's "create + delete", because SabreDAV will trigger an automatic delete of the target before running this method. So in the end only a check on "create" is needed.
Even though the "update" permission semantically seems to fit better for overwrites, it never quite worked as expected.
@LukasReschke another one for you 😉