Fwd: [user-manager/Plasma/5.8] src: Revert "Do not ask for root permissions when it's unnecessary"

Simon Quigley tsimonq2 at ubuntu.com
Tue Dec 13 02:15:03 UTC 2016


Hey guys,

So this affects us, I'm not currently in a location with my private GPG 
key, so I can't sign packages to upload them to backports-landing etc.

Could a ninja please push a fix to backports-landing and get a fix ready 
for Zesty archive ASAP so a Kubuntu Developer/MOTU could upload? The 
sooner the better.

-------- Original Message --------
Subject: [user-manager/Plasma/5.8] src: Revert "Do not ask for root 
permissions when it's unnecessary"
Date: 2016-12-12 04:57
 From: Harald Sitter <null at kde.org>
To: kde-commits at kde.org
Cc: kde-distro-packagers at kde.org, larrosa at kde.org

Git commit f2c69db182fb20453e671359e90a3bc6de40c7b0 by Harald Sitter.
Committed on 06/12/2016 at 10:54.
Pushed by sitter into branch 'Plasma/5.8'.

Revert "Do not ask for root permissions when it's unnecessary"

Summary:
This reverts commit a666712102be7ef4dd48202cc2411921fc4d392b.

This broke adding new users when not setting realname or adminflag (i.e.
at present there is no way to create a !admin user at all).

Distributions, as we are still 3 weeks away from 5.8.5 I'd advise 
patching
this to restore working behavior for the time being.

The problem in particular is that the model gobbles up setData requests 
to
new rows and forwards them to newUserSetData which in turn caches them
until username&realname&admin are present and only then forwards the 
call
to accountsservice. By calling setData on-demand the three fields are 
not
set unless they in fact all where "toggled" from their default.

I suggest that the noop decision be moved into the setData itself. In 
there
it should be possible to accurately decide whether or not the data
actually changed and accountsservice needs to be called.

(Ideally though IMO the collection in newUserSetData should be gotten
  rid of. I haven't had a close look, but creating the user with random
  data for everything but username and then manipulating it on the
  subsequent setData calls should be a more future-proof and reliable
  approach)

BUG: 373276
CCMAIL: kde-distro-packagers at kde.org
CCMAIL: larrosa at kde.org
PHAB: https://phabricator.kde.org/D3102

Reviewers: davidedmundson, mart

Subscribers: antlarr, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D3605

M  +10   -20   src/accountinfo.cpp
M  +2    -0    src/lib/accountmodel.cpp

https://commits.kde.org/user-manager/f2c69db182fb20453e671359e90a3bc6de40c7b0

diff --git a/src/accountinfo.cpp b/src/accountinfo.cpp
index 5949fc7..c2ae62d 100644
--- a/src/accountinfo.cpp
+++ b/src/accountinfo.cpp
@@ -154,30 +154,20 @@ bool AccountInfo::save()

      qCDebug(USER_MANAGER_LOG) << "Saving on Index: " << m_index.row();
      QList<AccountModel::Role> failed;
-    if (m_infoToSave.contains(AccountModel::Username)) {
-        if (!m_model->setData(m_index, m_info->username->text(), 
AccountModel::Username)) {
-            failed.append(AccountModel::Username);
-        }
+    if (!m_model->setData(m_index, m_info->username->text(), 
AccountModel::Username)) {
+        failed.append(AccountModel::Username);
      }
-    if (m_infoToSave.contains(AccountModel::RealName)) {
-        if (!m_model->setData(m_index, m_info->realName->text(), 
AccountModel::RealName)) {
-            failed.append(AccountModel::RealName);
-        }
+    if (!m_model->setData(m_index, m_info->realName->text(), 
AccountModel::RealName)) {
+        failed.append(AccountModel::RealName);
      }
-    if (m_infoToSave.contains(AccountModel::Email)) {
-        if (!m_model->setData(m_index, m_info->email->text(), 
AccountModel::Email)) {
-            failed.append(AccountModel::Email);
-        }
+    if (!m_model->setData(m_index, m_info->email->text(), 
AccountModel::Email)) {
+        failed.append(AccountModel::Email);
      }
-    if (m_infoToSave.contains(AccountModel::Administrator)) {
-        if (!m_model->setData(m_index, 
m_info->administrator->isChecked(), AccountModel::Administrator)) {
-            failed.append(AccountModel::Administrator);
-        }
+    if (!m_model->setData(m_index, m_info->administrator->isChecked(), 
AccountModel::Administrator)) {
+        failed.append(AccountModel::Administrator);
      }
-    if (m_infoToSave.contains(AccountModel::AutomaticLogin)) {
-        if (!m_model->setData(m_index, 
m_info->automaticLogin->isChecked(), AccountModel::AutomaticLogin)) {
-            failed.append(AccountModel::AutomaticLogin);
-        }
+    if (!m_model->setData(m_index, m_info->automaticLogin->isChecked(), 
AccountModel::AutomaticLogin)) {
+        failed.append(AccountModel::AutomaticLogin);
      }
      if (m_infoToSave.contains(AccountModel::Password)) {
          if (!m_model->setData(m_index, 
m_infoToSave[AccountModel::Password], AccountModel::Password)) {
diff --git a/src/lib/accountmodel.cpp b/src/lib/accountmodel.cpp
index 50006c8..10a7301 100644
--- a/src/lib/accountmodel.cpp
+++ b/src/lib/accountmodel.cpp
@@ -162,6 +162,8 @@ bool AccountModel::setData(const QModelIndex& index, 
const QVariant& value, int
              }
              m_kEmailSettings.setSetting(KEMailSettings::RealName, 
value.toString());

+            m_dbus->UncacheUser(acc->userName()).waitForFinished();
+            m_dbus->CacheUser(acc->userName());
              emit dataChanged(index, index);
              return true;
          case AccountModel::Username:

-- 
Simon Quigley
tsimonq2 at ubuntu.com
tsimonq2 on freenode and OFTC
5C7A BEA2 0F86 3045 9CC8
C8B5 E27F 2CF8 458C 2FA4



More information about the kubuntu-devel mailing list