Merge pull request #26215 from nextcloud/backport/26145/stable21
[stable21] add (hidden) option to always show smb root as writable
This commit is contained in:
commit
b3bf640111
|
@ -97,6 +97,9 @@ class SMB extends Common implements INotifyStorage {
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
protected $checkAcl;
|
protected $checkAcl;
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
protected $rootWritable;
|
||||||
|
|
||||||
public function __construct($params) {
|
public function __construct($params) {
|
||||||
if (!isset($params['host'])) {
|
if (!isset($params['host'])) {
|
||||||
throw new \Exception('Invalid configuration, no host provided');
|
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->showHidden = isset($params['show_hidden']) && $params['show_hidden'];
|
||||||
$this->checkAcl = isset($params['check_acl']) && $params['check_acl'];
|
$this->checkAcl = isset($params['check_acl']) && $params['check_acl'];
|
||||||
|
$this->rootWritable = isset($params['root_force_writable']) && $params['root_force_writable'];
|
||||||
|
|
||||||
$this->statCache = new CappedMemoryCache();
|
$this->statCache = new CappedMemoryCache();
|
||||||
parent::__construct($params);
|
parent::__construct($params);
|
||||||
|
@ -573,7 +577,11 @@ class SMB extends Common implements INotifyStorage {
|
||||||
private function getMetaDataFromFileInfo(IFileInfo $fileInfo) {
|
private function getMetaDataFromFileInfo(IFileInfo $fileInfo) {
|
||||||
$permissions = Constants::PERMISSION_READ + Constants::PERMISSION_SHARE;
|
$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_DELETE;
|
||||||
$permissions += Constants::PERMISSION_UPDATE;
|
$permissions += Constants::PERMISSION_UPDATE;
|
||||||
if ($fileInfo->isDirectory()) {
|
if ($fileInfo->isDirectory()) {
|
||||||
|
|
Loading…
Reference in New Issue