From: Olivier Goffart Date: Wed, 24 Oct 2018 08:44:56 +0000 (+0200) Subject: owncloudcmd: fetch the dav user X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~468^2~449 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3e4486c078b8eb59d1b5793d810b50ca36d0b8bc;p=nextcloud-desktop.git 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 --- 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