Go to the documentation of this file.
10 #include <QDBusConnection>
13 #include <sys/types.h>
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(
"rndRelease").toString();
108 return value(
"release").toString();
113 int oldMode = value(
"deviceMode").toInt();
123 setValue(
"deviceMode", oldMode);
138 setValue(
"rndRelease",
release);
152 setValue(
"domain", QString(
domain).replace(
"-",
":"));
158 if (contains(
"ssl-verify"))
159 return value(
"ssl-verify").toBool();
166 int uid_min = getdef_num(
"UID_MIN", -1);
170 if (getuid() >=
static_cast<uid_t
>(uid_min)) {
171 return QDBusConnection::sessionBus();
178 QString sessionBusAddress = QString(
"unix:path=/run/user/%1/dbus/user_bus_socket")
180 return QDBusConnection::connectToBus(sessionBusAddress,
"userSessionBus");
Q_INVOKABLE void setDeviceMode(Ssu::DeviceModeFlags mode, enum Ssu::EditMode editMode=Ssu::Replace)
static QDBusConnection userSessionBus()
QPair< QString, QString > credentials(const QString &scope)
@ ReleaseMode
Enable Release mode.
@ Add
Make sure the given value is set in the bitmask.
Q_INVOKABLE QString domain(bool pretty=false)
Q_INVOKABLE void setRelease(const QString &release, bool rnd=false)
Q_INVOKABLE void setDomain(const QString &domain)
@ Remove
Make sure the given value is not set in the bitmask.
@ RndMode
Enable RnD mode for device.
Q_INVOKABLE bool useSslVerify()
Q_INVOKABLE bool isRegistered()
Q_INVOKABLE QString brand()
Q_INVOKABLE void setFlavour(const QString &flavour)
Q_INVOKABLE QString flavour()
QString credentialsScope(const QString &repoName, bool rndRepo=false)
Q_INVOKABLE Ssu::DeviceModeFlags deviceMode()
Q_INVOKABLE QString release(bool rnd=false)
QString credentialsUrl(const QString &scope)
Q_INVOKABLE QDateTime lastCredentialsUpdate()