mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-21 12:35:52 +03:00
Properly provide both user-provided username AND backing user ID to File Provider Extension
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
cbf4ea571e
commit
6f1322fe47
5 changed files with 15 additions and 7 deletions
|
@ -46,11 +46,12 @@ class FileProviderSocketLineProcessor: NSObject, LineProcessor {
|
|||
delegate.removeAccountConfig()
|
||||
} else if command == "ACCOUNT_DETAILS" {
|
||||
guard let accountDetailsSubsequence = splitLine.last else { return }
|
||||
let splitAccountDetails = accountDetailsSubsequence.split(separator: "~", maxSplits: 2)
|
||||
let splitAccountDetails = accountDetailsSubsequence.split(separator: "~", maxSplits: 3)
|
||||
|
||||
let user = String(splitAccountDetails[0])
|
||||
let serverUrl = String(splitAccountDetails[1])
|
||||
let password = String(splitAccountDetails[2])
|
||||
let userId = String(splitAccountDetails[1])
|
||||
let serverUrl = String(splitAccountDetails[2])
|
||||
let password = String(splitAccountDetails[3])
|
||||
|
||||
delegate.setupDomainAccount(user: user, serverUrl: serverUrl, password: password)
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
- (void)getExtensionAccountIdWithCompletionHandler:(void(^)(NSString *extensionAccountId, NSError *error))completionHandler;
|
||||
- (void)configureAccountWithUser:(NSString *)user
|
||||
userId:(NSString *)userId
|
||||
serverUrl:(NSString *)serverUrl
|
||||
password:(NSString *)password;
|
||||
- (void)removeAccountConfig;
|
||||
|
|
|
@ -48,11 +48,13 @@ class ClientCommunicationService: NSObject, NSFileProviderServiceSource, NSXPCLi
|
|||
completionHandler(accountUserId, nil)
|
||||
}
|
||||
|
||||
func configureAccount(withUser user: String,
|
||||
func configureAccount(withUser user: String,
|
||||
userId: String,
|
||||
serverUrl: String,
|
||||
password: String) {
|
||||
Logger.desktopClientConnection.info("Received configure account information over client communication service")
|
||||
self.fpExtension.setupDomainAccount(user: user,
|
||||
userId: userId,
|
||||
serverUrl: serverUrl,
|
||||
password: password)
|
||||
}
|
||||
|
|
|
@ -213,13 +213,15 @@ void FileProviderSocketController::sendAccountDetails() const
|
|||
|
||||
const auto credentials = account->credentials();
|
||||
Q_ASSERT(credentials);
|
||||
const auto accountUser = account->davUser();
|
||||
const auto accountUrl = account->url().toString();
|
||||
const auto accountPassword = credentials->password();
|
||||
const auto accountUser = credentials->user(); // User-provided username/email
|
||||
const auto accountUserId = account->davUser(); // Backing user id on server
|
||||
const auto accountUrl = account->url().toString(); // Server base URL
|
||||
const auto accountPassword = credentials->password(); // Account password
|
||||
|
||||
// We cannot use colons as separators here due to "https://" in the url
|
||||
const auto message = QString(QStringLiteral("ACCOUNT_DETAILS:") +
|
||||
accountUser + "~" +
|
||||
accountUserId + "~" +
|
||||
accountUrl + "~" +
|
||||
accountPassword);
|
||||
sendMessage(message);
|
||||
|
|
|
@ -64,11 +64,13 @@ void FileProviderXPC::authenticateExtension(const QString &extensionAccountId) c
|
|||
const auto account = accountState->account();
|
||||
const auto credentials = account->credentials();
|
||||
NSString *const user = credentials->user().toNSString();
|
||||
NSString *const userId = account->davUser().toNSString();
|
||||
NSString *const serverUrl = account->url().toString().toNSString();
|
||||
NSString *const password = credentials->password().toNSString();
|
||||
|
||||
const auto clientCommService = (NSObject<ClientCommunicationProtocol> *)_clientCommServices.value(extensionAccountId);
|
||||
[clientCommService configureAccountWithUser:user
|
||||
userId:userId
|
||||
serverUrl:serverUrl
|
||||
password:password];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue