Skip to content

Commit

Permalink
Merge pull request #26216 from nextcloud/backport/26145/stable19
Browse files Browse the repository at this point in the history
[stable19] add (hidden) option to always show smb root as writable
  • Loading branch information
rullzer authored Mar 20, 2021
2 parents a4d6201 + ec0ca19 commit 9b23da2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/files_external/lib/Lib/Storage/SMB.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -134,6 +137,7 @@ public function __construct($params) {

$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);
Expand Down Expand Up @@ -567,7 +571,11 @@ public function getMetaData($path) {
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()) {
Expand Down

0 comments on commit 9b23da2

Please sign in to comment.