From cbf4ea571ec545e59c361117efe37413144f25fe Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 30 Sep 2024 14:05:33 +0800 Subject: [PATCH] Fetch user profile (and user ID) when setting up domain account Signed-off-by: Claudio Cambra --- ...ileProviderExtension+ClientInterface.swift | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension+ClientInterface.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension+ClientInterface.swift index ad9c24d03..878569945 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension+ClientInterface.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension+ClientInterface.swift @@ -163,6 +163,26 @@ extension FileProviderExtension: NSFileProviderServicing, ChangeNotificationInte remoteInterface: ncKit, changeNotificationInterface: self, domain: domain ) ncKit.setup(delegate: changeObserver) + + Task { + let (_, profile, _, error) = await ncKit.fetchUserProfile() + guard error == .success, let profile else { + // Note that since the authentication check checks for the user profile, this should + // not really occur + Logger.fileProviderExtension.error( + """ + Unable to get user profile for user \(user, privacy: .public) + at server \(serverUrl, privacy: .public) + error: \(error.errorDescription, privacy: .public) + """ + ) + return + } + ncKit.setup(user: user, userId: profile.userId, password: password, urlBase: serverUrl) + semaphore.signal() + } + semaphore.wait() + signalEnumeratorAfterAccountSetup() } -- 2.30.2