Fetch user profile (and user ID) when setting up domain account

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-09-30 14:05:33 +08:00
parent 4d96dbbc7a
commit cbf4ea571e

View 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()
}