2021-05-19 15:07:10 +02:00
|
|
|
#ifndef DBUSCONNECTION_H
|
|
|
|
|
#define DBUSCONNECTION_H
|
|
|
|
|
|
|
|
|
|
#include <QDBusAbstractAdaptor>
|
2024-02-18 20:58:27 +01:00
|
|
|
#include <QDBusMessage>
|
2021-05-19 15:07:10 +02:00
|
|
|
#include <QDBusVariant>
|
|
|
|
|
|
2024-02-19 12:52:17 +01:00
|
|
|
class IsolationManager;
|
2021-05-19 15:07:10 +02:00
|
|
|
|
|
|
|
|
class DBusConnection : public QDBusAbstractAdaptor
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2024-02-19 12:52:17 +01:00
|
|
|
Q_CLASSINFO("D-Bus Interface", "org.tom.IsolationRunner")
|
2024-02-20 20:27:07 +01:00
|
|
|
Q_CLASSINFO("URL", "https://codeberg.org/zander/isolationRunner")
|
2021-05-19 15:07:10 +02:00
|
|
|
public:
|
2024-02-19 12:52:17 +01:00
|
|
|
explicit DBusConnection(IsolationManager *parent);
|
2021-05-19 15:07:10 +02:00
|
|
|
|
|
|
|
|
public slots:
|
2024-02-20 20:27:07 +01:00
|
|
|
// simple way to run an application in our setup.
|
|
|
|
|
// this is useful because on dbus introspection will show how to use it.
|
2024-02-19 10:47:36 +01:00
|
|
|
void run(const QString &fullPath, const QStringList &arguments, const QDBusMessage &message);
|
2024-02-20 20:27:07 +01:00
|
|
|
// a more complex version, which is called by run(), it has more features.
|
2024-02-19 19:52:24 +01:00
|
|
|
void run2(const QDBusMessage &message);
|
2024-02-20 20:27:07 +01:00
|
|
|
/// returns a list of our profiles.
|
2024-02-25 19:48:41 +01:00
|
|
|
QDBusVariant listProfiles(bool verbose) const;
|
2024-02-20 20:27:07 +01:00
|
|
|
/// Return an XML with details for a specific profile
|
|
|
|
|
void details(const QString &profile, const QDBusMessage &message) const;
|
|
|
|
|
// Update the permissions for a certain profile.
|
|
|
|
|
// Notice that if a property is not in the list of known properties, we ignore it.
|
2024-02-18 20:58:27 +01:00
|
|
|
// it doesn't make sense to reply since the only reply that makes sense is
|
|
|
|
|
// to return a full details() call.
|
2024-02-20 20:27:07 +01:00
|
|
|
Q_NOREPLY void setRights(const QString &profile, const QStringList &denied, const QStringList &allowed);
|
2021-05-19 15:07:10 +02:00
|
|
|
|
|
|
|
|
private:
|
2024-02-20 20:27:07 +01:00
|
|
|
// generates and returns a failure message.
|
2024-02-19 19:52:24 +01:00
|
|
|
void fail(const QDBusMessage &message, const QString &errorMessage) const;
|
2024-02-19 12:52:17 +01:00
|
|
|
IsolationManager *m_parent;
|
2021-05-19 15:07:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|