Merge pull request #36810 from nextcloud/setup-user-onetime-before-mounts

do onetime user setup before getting any mount from providers
pull/37399/head
Robin Appelman 1 year ago committed by GitHub
commit 36835b7fec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -235,11 +235,13 @@ class SetupManager {
* part of the user setup that is run only once per user * part of the user setup that is run only once per user
*/ */
private function oneTimeUserSetup(IUser $user) { private function oneTimeUserSetup(IUser $user) {
if (in_array($user->getUID(), $this->setupUsers, true)) { if ($this->isSetupStarted($user)) {
return; return;
} }
$this->setupUsers[] = $user->getUID(); $this->setupUsers[] = $user->getUID();
$this->setupRoot();
$this->eventLogger->start('fs:setup:user:onetime', 'Onetime filesystem for user'); $this->eventLogger->start('fs:setup:user:onetime', 'Onetime filesystem for user');
$this->setupBuiltinWrappers(); $this->setupBuiltinWrappers();
@ -319,11 +321,7 @@ class SetupManager {
* @throws \OC\ServerNotAvailableException * @throws \OC\ServerNotAvailableException
*/ */
private function setupForUserWith(IUser $user, callable $mountCallback): void { private function setupForUserWith(IUser $user, callable $mountCallback): void {
$this->setupRoot(); $this->oneTimeUserSetup($user);
if (!$this->isSetupStarted($user)) {
$this->oneTimeUserSetup($user);
}
if ($this->lockdownManager->canAccessFilesystem()) { if ($this->lockdownManager->canAccessFilesystem()) {
$mountCallback(); $mountCallback();
@ -422,9 +420,7 @@ class SetupManager {
return; return;
} }
if (!$this->isSetupStarted($user)) { $this->oneTimeUserSetup($user);
$this->oneTimeUserSetup($user);
}
$this->eventLogger->start('fs:setup:user:path', "Setup $path filesystem for user"); $this->eventLogger->start('fs:setup:user:path', "Setup $path filesystem for user");
$this->eventLogger->start('fs:setup:user:path:find', "Find mountpoint for $path"); $this->eventLogger->start('fs:setup:user:path:find', "Find mountpoint for $path");
@ -513,6 +509,8 @@ class SetupManager {
$this->eventLogger->start('fs:setup:user:providers', "Setup filesystem for " . implode(', ', $providers)); $this->eventLogger->start('fs:setup:user:providers', "Setup filesystem for " . implode(', ', $providers));
$this->oneTimeUserSetup($user);
// home providers are always used // home providers are always used
$providers = array_filter($providers, function (string $provider) { $providers = array_filter($providers, function (string $provider) {
return !is_subclass_of($provider, IHomeMountProvider::class); return !is_subclass_of($provider, IHomeMountProvider::class);

Loading…
Cancel
Save