From 3e4486c078b8eb59d1b5793d810b50ca36d0b8bc Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 24 Oct 2018 10:44:56 +0200 Subject: [PATCH] owncloudcmd: fetch the dav user This is required to get the new endpoint working when the server uses ldap or that the dav user is not the same as the login. Issue #6830 --- src/cmd/cmd.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/cmd/cmd.cpp b/src/cmd/cmd.cpp index 3de2c43e3..62f719a78 100644 --- a/src/cmd/cmd.cpp +++ b/src/cmd/cmd.cpp @@ -466,13 +466,22 @@ int main(int argc, char **argv) loop.quit(); }); job->start(); - loop.exec(); if (job->reply()->error() != QNetworkReply::NoError){ std::cout<<"Error connecting to server\n"; return EXIT_FAILURE; } + + job = new JsonApiJob(account, QLatin1String("ocs/v1.php/cloud/user")); + QObject::connect(job, &JsonApiJob::jsonReceived, [&](const QJsonDocument &json) { + const QJsonObject data = json.object().value("ocs").toObject().value("data").toObject(); + account->setDavUser(data.value("id").toString()); + account->setDavDisplayName(data.value("display-name").toString()); + loop.quit(); + }); + job->start(); + loop.exec(); } // much lower age than the default since this utility is usually made to be run right after a change in the tests -- 2.30.2