Skip to content

Conversation

@jvillafanez
Copy link
Member

Description

Using LDAP, setting up the whole FS causes a connection to the LDAP server because we need to mount the shares of any group the user belongs to. This is confusing with some commands that don't expect a connection to the LDAP server since the users are fetched from the DB.

In order to solve this, the commands will setup the FS partially. This means that no mounts will be added other than the home one. This is expected to affect access to shares and external storages. However, the touched commands should need to access to those locations.

Note that, by default, the whole FS will be initialized. For web access, this is done pretty early (in "lib/base.php"), meaning that this feature is mostly limited to CLI.

The main goal of this feature is to prevent hitting the LDAP server. In case the LDAP server isn't accessible, the modified commands will still run instead of crashing. As side effect, there is a minor performance improvement due to the initialization skip (a few ms per FS setup)

Related Issue

https://github.com/owncloud/enterprise/issues/5081

Motivation and Context

Some commands crash due to hitting the LDAP server, although they shouldn't hit the LDAP server in the first place.

How Has This Been Tested?

  1. Setup LDAP connection
  2. Set 'trashbin_retention_obligation' => '0, 0', in the config.php file to remove the files from the trashbin without waiting.
  3. Add some files in a LDAP account
  4. Remove some files from the LDAP account
  5. Stop the LDAP server
  6. Run the occ trashbin:expire command

The command runs without crashing.

The rest of the touched commands and brackground jobs should behave the same way, although they haven't tested yet.

Note that the occ trashbin:cleanup command might still crash because it gets the users from the backend directly, not through the account.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

@update-docs
Copy link

update-docs bot commented Apr 29, 2022

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@jvillafanez
Copy link
Member Author

We might need to include a list with the affected apps in the release notes when this PR is released

$mounts[] = $homeMount;
$mountConfigManager->registerMounts($userObject, $mounts);
}
if (!$partial) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to see here not inverted logic ....

@DeepDiver1975
Copy link
Member

besides the comment above this looks reasonable

@sonarqubecloud
Copy link

sonarqubecloud bot commented May 3, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

64.3% 64.3% Coverage
0.0% 0.0% Duplication

@jvillafanez jvillafanez merged commit 774453e into master May 4, 2022
@delete-merged-branch delete-merged-branch bot deleted the allow_partial_fs_setup branch May 4, 2022 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants