Fix file permissions for SMB (read-only folders will be writeable) (#25301)

* Fix file permissions for SMB (read-only folders will be writeable)

* Read-only folders won't be deletable

* Added comment for the read-only behaviour for folders
This commit is contained in:
Juan Pablo Villafañez 2016-07-20 14:22:04 +02:00 committed by Lukas Reschke
parent b37e1ed17f
commit c376eb9f90
No known key found for this signature in database
GPG Key ID: B9F6980CF6E759B1
1 changed files with 13 additions and 0 deletions

View File

@ -381,6 +381,19 @@ class SMB extends \OC\Files\Storage\Common {
}
public function isUpdatable($path) {
try {
$info = $this->getFileInfo($path);
// following windows behaviour for read-only folders: they can be written into
// (https://support.microsoft.com/en-us/kb/326549 - "cause" section)
return !$info->isHidden() && (!$info->isReadOnly() || $this->is_dir($path));
} catch (NotFoundException $e) {
return false;
} catch (ForbiddenException $e) {
return false;
}
}
public function isDeletable($path) {
try {
$info = $this->getFileInfo($path);
return !$info->isHidden() && !$info->isReadOnly();