Commit 2b9ea88c authored by Nicolas Fella's avatar Nicolas Fella
Browse files

[kcms/user] Set interactive auth flag for more calls

Creating and deleting users needs that too

This also means that we need to be more correct with the types passed into the DBus calls since with passing the args as list we don't get implicit conversion to the correct type any more

BUG: 450122
FIXED-IN: 5.24.2
(cherry picked from commit 79113d99)
parent 16b4ee51
Pipeline #138268 passed with stage
in 15 minutes and 59 seconds
......@@ -28,6 +28,15 @@ Q_LOGGING_CATEGORY(kcm_users, "kcm_users")
K_PLUGIN_CLASS_WITH_JSON(KCMUser, "kcm_users.json")
// Work around QTBUG-100458
inline auto asyncCall(OrgFreedesktopAccountsInterface *ptr, const QString &method, const QVariantList &arguments)
auto mc = QDBusMessage::createMethodCall(ptr->service(), ptr->path(), ptr->interface(), method);
return QDBusConnection::systemBus().asyncCall(mc);
KCMUser::KCMUser(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
: KQuickAddons::ConfigModule(parent, data, args)
, m_dbusInterface(new OrgFreedesktopAccountsInterface(QStringLiteral("org.freedesktop.Accounts"),
......@@ -56,7 +65,7 @@ KCMUser::KCMUser(QObject *parent, const KPluginMetaData &data, const QVariantLis
bool KCMUser::createUser(const QString &name, const QString &realName, const QString &password, bool isAdmin)
QDBusPendingReply<QDBusObjectPath> reply = m_dbusInterface->CreateUser(name, realName, isAdmin);
QDBusPendingReply<QDBusObjectPath> reply = asyncCall(m_dbusInterface, "CreateUser", {name, realName, static_cast<qint32>(isAdmin)});
if (reply.isValid()) {
User *createdUser = new User(this);
......@@ -68,9 +77,9 @@ bool KCMUser::createUser(const QString &name, const QString &realName, const QSt
return false;
bool KCMUser::deleteUser(int id, bool deleteHome)
bool KCMUser::deleteUser(qint64 id, bool deleteHome)
QDBusPendingReply<> reply = m_dbusInterface->DeleteUser(id, deleteHome);
QDBusPendingReply<> reply = asyncCall(m_dbusInterface, "DeleteUser", {id, deleteHome});
if (reply.isError()) {
return false;
......@@ -32,7 +32,7 @@ public:
~KCMUser() override;
Q_SCRIPTABLE bool createUser(const QString &name, const QString &realName, const QString &password, bool admin);
Q_SCRIPTABLE bool deleteUser(int index, bool deleteHome);
Q_SCRIPTABLE bool deleteUser(qint64 index, bool deleteHome);
// Grab the initials of a string
Q_SCRIPTABLE QString initializeString(const QString &stringToGrabInitialsOf);
Q_SCRIPTABLE QString plonkImageInTempfile(const QImage &image);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment