summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2021-03-19 15:31:04 +0100
committerGitHub <noreply@github.com>2021-03-19 15:31:04 +0100
commitfb09f3d31d468411960c10213f460aaf83b523c4 (patch)
treeb93c865d4d0985f0f29b646d366c0dae43944203 /apps/files_external
parente6fd9b2f55b1920c5e3bb2c2448ec3488acc56c9 (diff)
parent5ffaa94fbc9a879af28e51ccbe13469cbb79cfdb (diff)
downloadnextcloud-server-fb09f3d31d468411960c10213f460aaf83b523c4.tar.gz
nextcloud-server-fb09f3d31d468411960c10213f460aaf83b523c4.zip
Merge pull request #26145 from nextcloud/smb-force-write-option
add (hidden) option to always show smb root as writable
Diffstat (limited to 'apps/files_external')
-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()) {