]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix file permissions for SMB (read-only folders will be writeable) (#25301) 465/head
authorJuan Pablo VillafaƱez <jvillafanez@solidgear.es>
Wed, 20 Jul 2016 12:22:04 +0000 (14:22 +0200)
committerLukas Reschke <lukas@statuscode.ch>
Wed, 20 Jul 2016 12:45:42 +0000 (14:45 +0200)
* 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

apps/files_external/lib/Lib/Storage/SMB.php

index e677f8c9eba916027ff84364972cd9002066b25d..b9613adff21b7ab3f9f70e7dc99bb9a07d8f0c77 100644 (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();