Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Reverting "[ssu] Expose new dbus API for updating the store credentia…
…ls."

Revert "[ssu] Expose new dbus API for updating the store credentials."

This reverts commit 38a3052.
  • Loading branch information
Bernd Wachter committed Nov 9, 2013
1 parent eaf76c2 commit 287355c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 24 deletions.
4 changes: 0 additions & 4 deletions dbus/org.nemo.ssu.xml
Expand Up @@ -88,10 +88,6 @@
</method>
<method name="updateRepos">
</method>
<method name="updateStoreCredentials">
<arg direction="in" type="s" name="userName" />
<arg direction="in" type="s" name="accessToken" />
</method>

<method name="error">
<arg direction="out" type="b" name="status"/>
Expand Down
24 changes: 17 additions & 7 deletions libssu/ssu.cpp
Expand Up @@ -609,13 +609,23 @@ void Ssu::updateCredentials(bool force){
manager->get(request);
}

void Ssu::updateStoreCredentials(const QString &userName, const QString &accessToken){
SsuCoreConfig *settings = SsuCoreConfig::instance();
settings->beginGroup("credentials-store");
settings->setValue("username", userName);
settings->setValue("password", accessToken);
settings->endGroup();
settings->sync();
void Ssu::updateStoreCredentials(){
QDBusMessage message = QDBusMessage::createMethodCall("com.jolla.jollastore",
"/StoreClient",
"com.jolla.jollastore",
"storeCredentials");
QDBusPendingReply<QString, QString> reply = QDBusConnection::sessionBus().asyncCall(message);
reply.waitForFinished();
if (reply.isError()) {
setError(QString("Store credentials not received. %1").arg(reply.error().message()));
} else {
SsuCoreConfig *settings = SsuCoreConfig::instance();
settings->beginGroup("credentials-store");
settings->setValue("username", reply.argumentAt<0>());
settings->setValue("password", reply.argumentAt<1>());
settings->endGroup();
settings->sync();
}
}

void Ssu::unregister(){
Expand Down
2 changes: 1 addition & 1 deletion libssu/ssu.h
Expand Up @@ -180,7 +180,7 @@ class Ssu: public QObject {
/**
* Try to update credentials for (Jolla) store
*/
void updateStoreCredentials(const QString &userName, const QString &accessToken);
void updateStoreCredentials();

signals:
/**
Expand Down
5 changes: 0 additions & 5 deletions ssud/ssud.cpp
Expand Up @@ -194,8 +194,3 @@ void Ssud::updateRepos(){
repoManager.update();
autoclose.start();
}

void Ssud::updateStoreCredentials(const QString &userName, const QString &accessToken){
ssu.updateStoreCredentials(userName, accessToken);
autoclose.start();
}
1 change: 0 additions & 1 deletion ssud/ssud.h
Expand Up @@ -42,7 +42,6 @@ class Ssud: public QObject {
void modifyRepo(int action, const QString &repo);
void addRepo(const QString &repo, const QString &url);
void updateRepos();
void updateStoreCredentials(const QString &userName, const QString &accessToken);

bool error();
QString lastError();
Expand Down
11 changes: 5 additions & 6 deletions ssuurlresolver/ssuurlresolver.cpp
Expand Up @@ -139,12 +139,11 @@ void SsuUrlResolver::run(){
// store-auth-repos domain setting use store credentials. Refresh
// here, as we only know after checking scope if we need to have
// store credentials at all

// store-client updates the store credentials via dbus call on
// every startup (or sign in to be precise).
// TODO: Is there need to check that the credentials were really
// set by store-client?

if (credentialsScope == "store"){
ssu.updateStoreCredentials();
if (ssu.error())
error (ssu.lastError());
}
headerList.append(QString("credentials=%1").arg(credentialsScope));
writeZyppCredentialsIfNeeded(credentialsScope);
} else
Expand Down

0 comments on commit 287355c

Please sign in to comment.