summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2021-03-20 10:53:40 +0100
committerGitHub <noreply@github.com>2021-03-20 10:53:40 +0100
commitb3bf6401113b56ef80b3fa9b88e592a8611d5484 (patch)
tree2f55922bac45776a4c36d808dba93f41dbb5d59c
parent798eff0161f7c5049e592d26aad1d31843db3ba1 (diff)
parent7f066931e44e7221e3e4e3685e59fff63a91e596 (diff)
downloadnextcloud-server-b3bf6401113b56ef80b3fa9b88e592a8611d5484.tar.gz
nextcloud-server-b3bf6401113b56ef80b3fa9b88e592a8611d5484.zip
Merge pull request #26215 from nextcloud/backport/26145/stable21
[stable21] add (hidden) option to always show smb root as writable
-rw-r--r--apps/files_external/lib/Lib/Storage/SMB.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php
index bc065b24552..45a01db76b3 100644
--- a/apps/files_external/lib/Lib/Storage/SMB.php
+++ b/apps/files_external/lib/Lib/Storage/SMB.php
@@ -97,6 +97,9 @@ class SMB extends Common implements INotifyStorage {
/** @var bool */
protected $checkAcl;
+ /** @var bool */
+ protected $rootWritable;
+
public function __construct($params) {
if (!isset($params['host'])) {
throw new \Exception('Invalid configuration, no host provided');
@@ -134,6 +137,7 @@ class SMB extends Common implements INotifyStorage {
$this->showHidden = isset($params['show_hidden']) && $params['show_hidden'];
$this->checkAcl = isset($params['check_acl']) && $params['check_acl'];
+ $this->rootWritable = isset($params['root_force_writable']) && $params['root_force_writable'];
$this->statCache = new CappedMemoryCache();
parent::__construct($params);
@@ -573,7 +577,11 @@ class SMB extends Common implements INotifyStorage {
private function getMetaDataFromFileInfo(IFileInfo $fileInfo) {
$permissions = Constants::PERMISSION_READ + Constants::PERMISSION_SHARE;
- if (!$fileInfo->isReadOnly()) {
+ if (
+ !$fileInfo->isReadOnly() || (
+ $this->rootWritable && $fileInfo->getPath() == $this->buildPath('')
+ )
+ ) {
$permissions += Constants::PERMISSION_DELETE;
$permissions += Constants::PERMISSION_UPDATE;
if ($fileInfo->isDirectory()) {