Skip to content
Snippets Groups Projects
Commit 31bb69bf authored by Emmanuel Lepage Vallee's avatar Emmanuel Lepage Vallee
Browse files

certificate: Begin to implement the daemon certificate store

Refs #70829
parent 4049b081
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,9 @@ ...@@ -20,6 +20,9 @@
//Ring //Ring
#include "certificate.h" #include "certificate.h"
//Dring
#include "dbus/configurationmanager.h"
class DaemonCertificateEditor : public CollectionEditor<Certificate> class DaemonCertificateEditor : public CollectionEditor<Certificate>
{ {
public: public:
...@@ -56,6 +59,8 @@ DaemonCertificateCollection::~DaemonCertificateCollection() ...@@ -56,6 +59,8 @@ DaemonCertificateCollection::~DaemonCertificateCollection()
bool DaemonCertificateCollection::load() bool DaemonCertificateCollection::load()
{ {
ConfigurationManagerInterface& configurationManager = DBus::ConfigurationManager::instance();
qDebug() << QStringList(configurationManager.getCertificateList());
return false; return false;
} }
......
...@@ -96,6 +96,18 @@ public: ...@@ -96,6 +96,18 @@ public:
QTimer::singleShot(0, [this,code] { QTimer::singleShot(0, [this,code] {
Q_EMIT this->errorAlert(code); Q_EMIT this->errorAlert(code);
}); });
}),
exportable_callback<ConfigurationSignal::CertificateAdded>(
[this] (const std::string &certId) {
QTimer::singleShot(0, [this, certId] {
Q_EMIT this->certificateAdded(QString(certId.c_str()));
});
}),
exportable_callback<ConfigurationSignal::CertificateExpired>(
[this] (const std::string &certId) {
QTimer::singleShot(0, [this, certId] {
Q_EMIT this->certificateExpired(QString(certId.c_str()));
});
}) })
}; };
} }
...@@ -505,6 +517,27 @@ public Q_SLOTS: // METHODS ...@@ -505,6 +517,27 @@ public Q_SLOTS: // METHODS
return temp; return temp;
} }
QStringList getCertificateList()
{
return convertStringList(DRing::getCertificateList());
}
QString addCertificate(const QByteArray& raw)
{
const std::vector<unsigned char> r(raw.begin(), raw.end());
return DRing::addCertificate(r).c_str();
}
bool addCertificateRemote(const QString& accountId, const QString& certificateId)
{
return DRing::addCertificateRemote(accountId.toStdString(), certificateId.toStdString());
}
bool banCertificate(const QString& id)
{
return DRing::banCertificate(id.toStdString());
}
Q_SIGNALS: // SIGNALS Q_SIGNALS: // SIGNALS
void volumeChanged(const QString &device, double value); void volumeChanged(const QString &device, double value);
void accountsChanged(); void accountsChanged();
...@@ -514,6 +547,8 @@ Q_SIGNALS: // SIGNALS ...@@ -514,6 +547,8 @@ Q_SIGNALS: // SIGNALS
void stunStatusSuccess(const QString &message); void stunStatusSuccess(const QString &message);
void errorAlert(int code); void errorAlert(int code);
void volatileAccountDetailsChanged(const QString &accountID, MapStringString details); void volatileAccountDetailsChanged(const QString &accountID, MapStringString details);
void certificateAdded(const QString& cert);
void certificateExpired(const QString& cert);
}; };
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
<interface name="cx.ring.Ring.ConfigurationManager"> <interface name="cx.ring.Ring.ConfigurationManager">
<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
Used to handle the configuration stuff: accounts settings, account registration, user preferences, ... Used to handle the configuration stuff: accounts settings, user preferences, ...
TODO: move runtime account stuff in accountmanager
</tp:docstring> </tp:docstring>
<method name="getAccountTemplate" tp:name-for-bindings="getAccountTemplate"> <method name="getAccountTemplate" tp:name-for-bindings="getAccountTemplate">
...@@ -235,6 +236,28 @@ ...@@ -235,6 +236,28 @@
</arg> </arg>
</method> </method>
<method name="sendTextMessage" tp:name-for-bindings="sendTextMessage">
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="MapStringString"/>
<arg type="s" name="accountID" direction="in">
</arg>
<arg type="s" name="to" direction="in">
</arg>
<arg type="s" name="message" direction="in">
</arg>
</method>
<signal name="incomingMessage" tp:name-for-bindings="incomingMessage">
<tp:docstring>
Notify clients that a new text message has been received at the account level.
</tp:docstring>
<arg type="s" name="accountID">
</arg>
<arg type="s" name="from">
</arg>
<arg type="s" name="message">
</arg>
</signal>
<method name="setVolume" tp:name-for-bindings="setVolume"> <method name="setVolume" tp:name-for-bindings="setVolume">
<tp:docstring> <tp:docstring>
<p>Sets the volume using a linear scale [0,100].</p> <p>Sets the volume using a linear scale [0,100].</p>
...@@ -691,6 +714,78 @@ ...@@ -691,6 +714,78 @@
</arg> </arg>
</method> </method>
<method name="getCertificateList" tp:name-for-bindings="getCertificateList">
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="VectorString"/>
<arg type="as" name="details" direction="out">
<tp:docstring>
<p>A list of all certificate IDs</p>
</tp:docstring>
</arg>
</method>
<method name="addCertificate" tp:name-for-bindings="addCertificate">
<arg type="ay" name="certificateRaw" direction="in">
<tp:docstring>
<p>A raw certificate</p>
</tp:docstring>
</arg>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="String"/>
<arg type="s" name="details" direction="out">
<tp:docstring>
<p>ID of the inserted certificate</p>
</tp:docstring>
</arg>
</method>
<method name="addCertificateRemote" tp:name-for-bindings="addCertificateRemote">
<arg type="s" name="accountId" direction="in">
<tp:docstring>
<p>An account ID</p>
</tp:docstring>
</arg>
<arg type="s" name="certificateId" direction="in">
<tp:docstring>
<p>A certificate ID</p>
</tp:docstring>
</arg>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="Boolean"/>
<arg type="b" name="details" direction="out">
<tp:docstring>
<p>True if the search started</p>
</tp:docstring>
</arg>
</method>
<method name="banCertificate" tp:name-for-bindings="banCertificate">
<arg type="s" name="certificateId" direction="in">
<tp:docstring>
<p>A certificate ID</p>
</tp:docstring>
</arg>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="Boolean"/>
<arg type="b" name="details" direction="out">
<tp:docstring>
<p>True if the certificate was actually banned.</p>
</tp:docstring>
</arg>
</method>
<signal name="certificateAdded" tp:name-for-bindings="certificateAdded">
<tp:docstring>
Notify clients that a certificate have been added to the store.
</tp:docstring>
<arg type="s" name="certId">
</arg>
</signal>
<signal name="certificateExpired" tp:name-for-bindings="certificateExpired">
<tp:docstring>
Notify clients that a certificate expired.
</tp:docstring>
<arg type="s" name="certId">
</arg>
</signal>
<method name="getAddrFromInterfaceName" tp:name-for-bindings="getAddrFromInterfaceName"> <method name="getAddrFromInterfaceName" tp:name-for-bindings="getAddrFromInterfaceName">
<arg type="s" name="interface" direction="in"> <arg type="s" name="interface" direction="in">
</arg> </arg>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment