Browse Source
Merge pull request #57542 from nextcloud/backport/51145/stable32
Merge pull request #57542 from nextcloud/backport/51145/stable32
[stable32] feat: Add appconfig to disable fixed userfolder permissions optimizationpull/57582/head
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 347 additions and 143 deletions
-
1apps/files/composer/composer/autoload_classmap.php
-
1apps/files/composer/composer/autoload_static.php
-
4apps/files/lib/AppInfo/Application.php
-
46apps/files/lib/ConfigLexicon.php
-
2apps/files_external/appinfo/info.xml
-
1apps/files_external/composer/composer/autoload_classmap.php
-
1apps/files_external/composer/composer/autoload_static.php
-
35apps/files_external/lib/Migration/Version1025Date20250228162604.php
-
28apps/files_external/lib/Service/DBConfigService.php
-
28apps/files_external/lib/Service/StoragesService.php
-
12apps/files_external/lib/Service/UserGlobalStoragesService.php
-
10apps/files_external/lib/Service/UserStoragesService.php
-
2apps/files_external/tests/Service/GlobalStoragesServiceTest.php
-
5apps/files_external/tests/Service/StoragesServiceTestCase.php
-
1apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php
-
4apps/files_external/tests/Service/UserStoragesServiceTest.php
-
22cypress/e2e/files_external/StorageUtils.ts
-
46cypress/e2e/files_external/home-folder-root-mount-permissions.cy.ts
-
64lib/private/Files/Node/LazyUserFolder.php
-
36lib/private/Files/Node/Root.php
-
1lib/private/Server.php
-
15tests/lib/Files/Node/FileTest.php
-
46tests/lib/Files/Node/FolderTest.php
-
2tests/lib/Files/Node/HookConnectorTest.php
-
2tests/lib/Files/Node/IntegrationTest.php
-
39tests/lib/Files/Node/NodeTestCase.php
-
36tests/lib/Files/Node/RootTest.php
@ -0,0 +1,46 @@ |
|||
<?php |
|||
|
|||
declare(strict_types=1); |
|||
/** |
|||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors |
|||
* SPDX-License-Identifier: AGPL-3.0-or-later |
|||
*/ |
|||
|
|||
namespace OCA\Files; |
|||
|
|||
use OCP\Config\Lexicon\Entry; |
|||
use OCP\Config\Lexicon\ILexicon; |
|||
use OCP\Config\Lexicon\Strictness; |
|||
use OCP\Config\ValueType; |
|||
|
|||
/** |
|||
* Config Lexicon for files. |
|||
* |
|||
* Please Add & Manage your Config Keys in that file and keep the Lexicon up to date! |
|||
* |
|||
* {@see ILexicon} |
|||
*/ |
|||
class ConfigLexicon implements ILexicon { |
|||
public const OVERWRITES_HOME_FOLDERS = 'overwrites_home_folders'; |
|||
|
|||
public function getStrictness(): Strictness { |
|||
return Strictness::NOTICE; |
|||
} |
|||
|
|||
public function getAppConfigs(): array { |
|||
return [ |
|||
new Entry( |
|||
self::OVERWRITES_HOME_FOLDERS, |
|||
ValueType::ARRAY, |
|||
defaultRaw: [], |
|||
definition: 'List of applications overwriting home folders', |
|||
lazy: false, |
|||
note: 'It will be populated with app IDs of mount providers that overwrite home folders. Currently, only files_external and groupfolders.', |
|||
), |
|||
]; |
|||
} |
|||
|
|||
public function getUserConfigs(): array { |
|||
return []; |
|||
} |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
<?php |
|||
|
|||
declare(strict_types=1); |
|||
|
|||
/** |
|||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors |
|||
* SPDX-License-Identifier: AGPL-3.0-or-later |
|||
*/ |
|||
|
|||
namespace OCA\Files_External\Migration; |
|||
|
|||
use Closure; |
|||
use OCA\Files_External\Service\GlobalStoragesService; |
|||
use OCP\DB\ISchemaWrapper; |
|||
use OCP\IAppConfig; |
|||
use OCP\Migration\IOutput; |
|||
use OCP\Migration\SimpleMigrationStep; |
|||
|
|||
/** |
|||
* Check for any external storage overwriting the home folder |
|||
*/ |
|||
class Version1025Date20250228162604 extends SimpleMigrationStep { |
|||
public function __construct( |
|||
private GlobalStoragesService $globalStoragesServices, |
|||
private IAppConfig $appConfig, |
|||
) { |
|||
} |
|||
|
|||
/** |
|||
* @param Closure(): ISchemaWrapper $schemaClosure |
|||
*/ |
|||
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { |
|||
$this->globalStoragesServices->updateOverwriteHomeFolders(); |
|||
} |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
/** |
|||
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors |
|||
* SPDX-License-Identifier: AGPL-3.0-or-later |
|||
*/ |
|||
|
|||
import { User } from '@nextcloud/cypress' |
|||
import { AuthBackend, createStorageWithConfig, deleteAllExternalStorages, setStorageMountOptions, StorageBackend } from './StorageUtils' |
|||
|
|||
describe('Home folder root mount permissions', { testIsolation: true }, () => { |
|||
let user1: User |
|||
|
|||
before(() => { |
|||
cy.runOccCommand('app:enable files_external') |
|||
cy.createRandomUser().then((user) => { user1 = user }) |
|||
}) |
|||
|
|||
after(() => { |
|||
deleteAllExternalStorages() |
|||
cy.runOccCommand('app:disable files_external') |
|||
}) |
|||
|
|||
it('Does not show write actions on read-only storage mounted at the root of the user\'s home folder', () => { |
|||
cy.login(user1) |
|||
cy.visit('/apps/files/') |
|||
cy.runOccCommand('config:app:get files overwrites_home_folders --default-value=[]') |
|||
.then(({ stdout }) => assert.equal(stdout.trim(), '[]')) |
|||
|
|||
cy.get('[data-cy-upload-picker=""]').should('exist') |
|||
|
|||
createStorageWithConfig('/', StorageBackend.LOCAL, AuthBackend.Null, { datadir: '/tmp' }) |
|||
.then((id) => setStorageMountOptions(id, { readonly: true })) |
|||
// HACK: somehow, we need to create an external folder targeting a subpath for the previous one to show.
|
|||
createStorageWithConfig('/a', StorageBackend.LOCAL, AuthBackend.Null, { datadir: '/tmp' }) |
|||
cy.visit('/apps/files/') |
|||
cy.visit('/apps/files/') |
|||
cy.runOccCommand('config:app:get files overwrites_home_folders') |
|||
.then(({ stdout }) => assert.equal(stdout.trim(), '["files_external"]')) |
|||
cy.get('[data-cy-upload-picker=""]').should('not.exist') |
|||
|
|||
deleteAllExternalStorages() |
|||
cy.visit('/apps/files/') |
|||
cy.runOccCommand('config:app:get files overwrites_home_folders') |
|||
.then(({ stdout }) => assert.equal(stdout.trim(), '[]')) |
|||
cy.get('[data-cy-upload-picker=""]').should('exist') |
|||
}) |
|||
}) |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue