Do not ask for root permissions when it's unnecessary
ClosedPublic

Authored by antlarr on Oct 18 2016, 5:06 PM.

Details

Summary

Only save values that were really changed

This allows to change settings without being asked for the root password
to save things that weren't modified by the user, so the
request for the root password was unnecessary.

Remove unneeded UncacheUser/CacheUser calls

Modifying the Real Name of the user was requesting the root password
because of the calls to UncacheUser/CacheUser, since modifying the Real
Name doesn't in fact need extra permissions. Also, none of the other
properties call UncacheUser/CacheUser when they're being modified, so
I tried removing the calls and it works much better here.

Test Plan

I tested changing avatar and Real Name and looking at /etc/passwd and ~/.face
that they were correctly changed while not getting any polkit dialog
requesting the root password.

Diff Detail

Repository
R128 User Manager
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
antlarr updated this revision to Diff 7514.Oct 18 2016, 5:06 PM
antlarr retitled this revision from to Do not ask for root permissions when it's unnecessary.
antlarr updated this object.
antlarr edited the test plan for this revision. (Show Details)
antlarr added a reviewer: Plasma.
Restricted Application added a project: Plasma. · View Herald TranscriptOct 18 2016, 5:06 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
mart added a subscriber: mart.Oct 19 2016, 9:39 AM
mart added inline comments.
src/lib/accountmodel.cpp
165

is there absolutely nothing left needing this?

Oops, sorry, I wrote a reply yesterday but forgot to submit it :/

src/lib/accountmodel.cpp
165

I can't find anything at least. I tested the systemsettings window is updated correctly everywhere, the screen locker shows the new name correctly and logging out shows the new name correctly. If you can tell me anything else to test, I'll test it.

davidedmundson accepted this revision.Oct 23 2016, 4:54 PM
davidedmundson added a reviewer: davidedmundson.
This revision is now accepted and ready to land.Oct 23 2016, 4:54 PM
antlarr closed this revision.Oct 24 2016, 10:57 AM