Commit 2471fa7d authored by Méven Car's avatar Méven Car
Browse files

Use a default non-administrator user Type for new users in model

If the administrator role was not set for the index assume the default normal user type.

Regression was introduced in D25398.

BUG: 414860
FIXED-IN: 5.18

Test Plan: Created a user as described in

Reviewers: ngraham, #plasma, apol

Reviewed By: ngraham

Subscribers: plasma-devel

Tags: #plasma

Differential Revision:
parent a2f7d308
......@@ -309,12 +309,16 @@ bool AccountModel::newUserSetData(const QModelIndex &index, const QVariant& valu
AccountModel::Role role = static_cast<AccountModel::Role>(roleInt);
m_newUserData[role] = value;
QList<AccountModel::Role> roles = m_newUserData.keys();
if (!roles.contains(Username) || !roles.contains(RealName) || !roles.contains(Administrator)) {
if (!roles.contains(Username) || !roles.contains(RealName)) {
return true;
// defaults to non-administrator
int userType = 0;
if (m_newUserData.contains(Administrator)) {
userType = m_newUserData[Administrator].toBool();
int userType = m_newUserData[Administrator].toBool() ? 1 : 0;
QDBusPendingReply <QDBusObjectPath > reply = m_dbus->CreateUser(m_newUserData[Username].toString(), m_newUserData[RealName].toString(), userType);
......@@ -327,7 +331,6 @@ bool AccountModel::newUserSetData(const QModelIndex &index, const QVariant& valu
//If we don't have anything else to set just return
if (m_newUserData.isEmpty()) {
Markdown is supported
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