]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Fetch user profile (and user ID) when setting up domain account
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 30 Sep 2024 06:05:33 +0000 (14:05 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 11 Oct 2024 08:40:47 +0000 (16:40 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension+ClientInterface.swift

index ad9c24d0377d8b9c85476c8b2295294668d0a1e4..87856994591922a2a4b88c43eb099d5a37d398ff 100644 (file)
@@ -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()
     }