summaryrefslogtreecommitdiff
path: root/lib/PolkitClient.cpp
blob: f20e694ad56bf6546e13b5bd7517a1bb97f69799 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <polkit-dbus/polkit-dbus.h>

#include "PolkitClient.h"
#include "constants.h"

using namespace PackageKit;

PolkitClient::PolkitClient(QObject *parent) : QObject(parent) {
}

bool PolkitClient::getAuth(const QString &action) {
	DBusError e;
	dbus_error_init(&e);

	bool auth = polkit_auth_obtain(action.toAscii().data(), 0, QCoreApplication::applicationPid(), &e);
	if(!auth) {
		qDebug() << "Authentification error :" << e.name << ":" << e.message;
	}

	return auth;
}