Skip to content

Commit fb09f3d

Browse files
authored
Merge pull request #26145 from nextcloud/smb-force-write-option
add (hidden) option to always show smb root as writable
2 parents e6fd9b2 + 5ffaa94 commit fb09f3d

File tree

1 file changed

+9
-1
lines changed
  • apps/files_external/lib/Lib/Storage

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ class SMB extends Common implements INotifyStorage {
9797
/** @var bool */
9898
protected $checkAcl;
9999

100+
/** @var bool */
101+
protected $rootWritable;
102+
100103
public function __construct($params) {
101104
if (!isset($params['host'])) {
102105
throw new \Exception('Invalid configuration, no host provided');
@@ -134,6 +137,7 @@ public function __construct($params) {
134137

135138
$this->showHidden = isset($params['show_hidden']) && $params['show_hidden'];
136139
$this->checkAcl = isset($params['check_acl']) && $params['check_acl'];
140+
$this->rootWritable = isset($params['root_force_writable']) && $params['root_force_writable'];
137141

138142
$this->statCache = new CappedMemoryCache();
139143
parent::__construct($params);
@@ -573,7 +577,11 @@ public function getMetaData($path) {
573577
private function getMetaDataFromFileInfo(IFileInfo $fileInfo) {
574578
$permissions = Constants::PERMISSION_READ + Constants::PERMISSION_SHARE;
575579

576-
if (!$fileInfo->isReadOnly()) {
580+
if (
581+
!$fileInfo->isReadOnly() || (
582+
$this->rootWritable && $fileInfo->getPath() == $this->buildPath('')
583+
)
584+
) {
577585
$permissions += Constants::PERMISSION_DELETE;
578586
$permissions += Constants::PERMISSION_UPDATE;
579587
if ($fileInfo->isDirectory()) {

0 commit comments

Comments
 (0)