10#include <QDBusConnection>
23 ssuCoreConfig =
new SsuCoreConfig;
30 QPair<QString, QString> ret;
31 beginGroup(
"credentials-" + scope);
32 ret.first = value(
"username").toString();
33 ret.second = value(
"password").toString();
43 if (contains(
"credentials-scope"))
44 return value(
"credentials-scope").toString();
46 return "your-configuration-is-broken-and-does-not-contain-credentials-scope";
51 if (contains(
"credentials-url-" + scope))
52 return value(
"credentials-url-" + scope).toString();
54 return "your-configuration-is-broken-and-does-not-contain-credentials-url-for-" + scope;
59 if (contains(
"flavour"))
60 return value(
"flavour").toString();
67 if (!contains(
"deviceMode"))
70 return Ssu::DeviceModeFlags(value(
"deviceMode").toInt());
75 if (contains(
"domain")) {
77 return value(
"domain").toString().replace(
":",
"-");
79 return value(
"domain").toString();
86 return value(
"brand").toString();
91 if (!contains(
"privateKey"))
93 if (!contains(
"certificate"))
95 return value(
"registered").toBool();
100 return value(
"lastCredentialsUpdate").toDateTime();
106 return value(
"release").toString();
111 int oldMode = value(
"deviceMode").toInt();
121 setValue(
"deviceMode", oldMode);
145 setValue(
"domain", QString(
domain).replace(
"-",
":"));
151 if (contains(
"ssl-verify"))
152 return value(
"ssl-verify").toBool();
159 int uid_min = getdef_num(
"UID_MIN", -1);
163 if (getuid() >=
static_cast<uid_t
>(uid_min)) {
164 return QDBusConnection::sessionBus();
171 QString sessionBusAddress = QString(
"unix:path=/run/user/%1/dbus/user_bus_socket")
173 return QDBusConnection::connectToBus(sessionBusAddress,
"userSessionBus");
Q_INVOKABLE QString domain(bool pretty=false)
QString credentialsScope(const QString &repoName, bool rndRepo=false)
Q_INVOKABLE void setFlavour(const QString &flavour)
Q_INVOKABLE bool useSslVerify()
Q_INVOKABLE QDateTime lastCredentialsUpdate()
Q_INVOKABLE Ssu::DeviceModeFlags deviceMode()
Q_INVOKABLE void setDeviceMode(Ssu::DeviceModeFlags mode, enum Ssu::EditMode editMode=Ssu::Replace)
Q_INVOKABLE bool isRegistered()
Q_INVOKABLE void setDomain(const QString &domain)
QString credentialsUrl(const QString &scope)
static QDBusConnection userSessionBus()
Q_INVOKABLE QString release(bool rnd=false)
Q_INVOKABLE QString brand()
Q_INVOKABLE void setRelease(const QString &release, bool rnd=false)
Q_INVOKABLE QString flavour()
QPair< QString, QString > credentials(const QString &scope)
@ ReleaseMode
Enable Release mode.
@ RndMode
Enable RnD mode for device.
@ Add
Make sure the given value is set in the bitmask.
@ Remove
Make sure the given value is not set in the bitmask.