on xenial help sign in
Fix accounts-service/policykit interaction
e884223Michael Terry
Shell.qml+2−2
@@ -59,7 +59,7 @@ FocusScope {
59 }
59 }
60 }
60 }
61
61
62− property bool showEdgeDemo: true
62+ property bool showEdgeDemo: false
63 property bool showEdgeDemoInGreeter: showEdgeDemo //AccountsService.getUserProperty("lightdm", "demo-edges")
63 property bool showEdgeDemoInGreeter: showEdgeDemo //AccountsService.getUserProperty("lightdm", "demo-edges")
64
64
65 function hideEdgeDemo() {
65 function hideEdgeDemo() {
@@ -494,7 +494,7 @@ FocusScope {
494 shell.background = bgPath ? bgPath : default_background
494 shell.background = bgPath ? bgPath : default_background
495 // Update edge demo hint
495 // Update edge demo hint
496 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole)
496 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole)
497− shell.showEdgeDemo = true //AccountsService.getUserProperty(user, "demo-edges")
497+ shell.showEdgeDemo = AccountsService.getUserProperty(user, "demo-edges")
498 }
498 }
499
499
500 onLeftTeaserPressedChanged: {
500 onLeftTeaserPressedChanged: {
debian/unity8-private.install+1
@@ -9,3 +9,4 @@ usr/lib/*/unity8/qml/Utils
9usr/share/accountsservice/interfaces
9usr/share/accountsservice/interfaces
10usr/share/dbus-1/interfaces
10usr/share/dbus-1/interfaces
11usr/share/polkit-1
11usr/share/polkit-1
12+var/lib/polkit-1
plugins/AccountsService/50-com.canonical.unity.AccountsService.pklanew file+6
@@ -0,0 +1,6 @@
1+[Allow LightDM to set Unity AccountsService fields]
2+Identity=unix-user:lightdm
3+Action=com.canonical.unity.AccountsService.ModifyAnyUser
4+ResultActive=yes
5+ResultInactive=yes
6+ResultAny=yes
plugins/AccountsService/AccountsService.cpp+4−3
@@ -17,8 +17,9 @@
17 */
17 */
18
18
19#include "AccountsService.h"
19#include "AccountsService.h"
20−#include <QtCore/QEvent>
20+#include <QtDBus/QDBusConnection>
21−#include <QtDBus/QDBusPendingReply>
21+#include <QtDBus/QDBusMessage>
22+#include <QtDBus/QDBusVariant>
22
23
23AccountsService::AccountsService(QObject* parent)
24AccountsService::AccountsService(QObject* parent)
24 : QObject(parent),
25 : QObject(parent),
@@ -47,7 +48,7 @@ void AccountsService::setUserProperty(const QString &user, const QString &proper
47{
48{
48 auto iface = getUserInterface(user);
49 auto iface = getUserInterface(user);
49 if (iface != nullptr && iface->isValid()) {
50 if (iface != nullptr && iface->isValid()) {
50− // The value needs to be carefully wrapped thrice
51+ // The value needs to be carefully wrapped
51 iface->call("Set", "com.canonical.unity.AccountsService", property, QVariant::fromValue(QDBusVariant(value)));
52 iface->call("Set", "com.canonical.unity.AccountsService", property, QVariant::fromValue(QDBusVariant(value)));
52 }
53 }
53}
54}
plugins/AccountsService/CMakeLists.txt+9−6
@@ -12,7 +12,10 @@ qt5_use_modules(AccountsService-qml DBus Qml)
12export_qmlfiles(AccountsService AccountsService)
12export_qmlfiles(AccountsService AccountsService)
13export_qmlplugin(AccountsService 0.1 AccountsService TARGETS AccountsService-qml)
13export_qmlplugin(AccountsService 0.1 AccountsService TARGETS AccountsService-qml)
14
14
15+# Debian defines CMAKE_INSTALL_LOCALSTATEDIR as /usr/var, which is wrong.
16+# So until Debian bug 719148 is fixed, hardcode it.
17+set(POLKIT_LIB_DIR "/var/lib/polkit-1")
15−set(POLICYKIT_DIR "${CMAKE_INSTALL_PREFIX}/share/polkit-1")
18+set(POLKIT_DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/polkit-1")
16set(DBUS_IFACE_DIR "${CMAKE_INSTALL_PREFIX}/share/dbus-1/interfaces")
19set(DBUS_IFACE_DIR "${CMAKE_INSTALL_PREFIX}/share/dbus-1/interfaces")
17set(ACCOUNTS_IFACE_DIR "${CMAKE_INSTALL_PREFIX}/share/accountsservice/interfaces")
20set(ACCOUNTS_IFACE_DIR "${CMAKE_INSTALL_PREFIX}/share/accountsservice/interfaces")
18
21
@@ -22,14 +25,14 @@ install(FILES com.canonical.unity.AccountsService.xml
22
25
23# Create accountsservice symlink for above dbus interface
26# Create accountsservice symlink for above dbus interface
24install(CODE "
27install(CODE "
25−execute_process(COMMAND mkdir -p \"$ENV{DESTDIR}${ACCOUNTS_IFACE_DIR}\")
28+execute_process(COMMAND mkdir -p \"\$ENV{DESTDIR}${ACCOUNTS_IFACE_DIR}\")
26−execute_process(COMMAND ln -sf ../../dbus-1/interfaces/com.canonical.unity.AccountsService.xml \"$ENV{DESTDIR}${ACCOUNTS_IFACE_DIR}\")
29+execute_process(COMMAND ln -sf ../../dbus-1/interfaces/com.canonical.unity.AccountsService.xml \"\$ENV{DESTDIR}${ACCOUNTS_IFACE_DIR}\")
27 ")
30 ")
28
31
29install(FILES com.canonical.unity.AccountsService.policy
32install(FILES com.canonical.unity.AccountsService.policy
30− DESTINATION "${POLICYKIT_DIR}/actions"
33+ DESTINATION "${POLKIT_DATA_DIR}/actions"
31 )
34 )
32
35
33−install(FILES com.canonical.unity.AccountsService.rules
36+install(FILES 50-com.canonical.unity.AccountsService.pkla
34− DESTINATION "${POLICYKIT_DIR}/rules.d"
37+ DESTINATION "${POLKIT_LIB_DIR}/localauthority/10-vendor.d"
35 )
38 )
plugins/AccountsService/com.canonical.unity.AccountsService.policy+16−5
@@ -1,13 +1,24 @@
1<?xml version="1.0" encoding="UTF-8"?>
1<?xml version="1.0" encoding="UTF-8"?>
2
2
3<policyconfig>
3<policyconfig>
4− <action id="com.canonical.unity.AccountsService.ModifyUsers">
4+ <action id="com.canonical.unity.AccountsService.ModifyOwnUser">
5+ <description>Set properties of own user</description>
6+ <message>Authentication is required to set one's own unity properties.</message>
7+ <defaults>
8+ <allow_any>yes</allow_any>
9+ <allow_inactive>yes</allow_inactive>
10+ <allow_active>yes</allow_active>
11+ </defaults>
12+ </action>
13+
14+ <action id="com.canonical.unity.AccountsService.ModifyAnyUser">
5 <description>Set properties of any user</description>
15 <description>Set properties of any user</description>
6− <message>Authentication is required to set another user's unity properties.</message>
16+ <message>Authentication is required to set another user's unity
17+properties.</message>
7 <defaults>
18 <defaults>
8− <allow_any>auth_admin_keep</allow_any>
19+ <allow_any>no</allow_any>
9− <allow_inactive>auth_admin_keep</allow_inactive>
20+ <allow_inactive>no</allow_inactive>
10− <allow_active>auth_admin_keep</allow_active>
21+ <allow_active>no</allow_active>
11 </defaults>
22 </defaults>
12 </action>
23 </action>
13</policyconfig>
24</policyconfig>
plugins/AccountsService/com.canonical.unity.AccountsService.rulesdeleted−5
@@ -1,5 +0,0 @@
1−polkit.addAdminRule(function(action, subject) {
2− if (action.id == "com.canonical.unity.AccountsService.ModifyUsers") {
3− return "unix-user:lightdm";
4− }
5−});
plugins/AccountsService/com.canonical.unity.AccountsService.xml+4−1
@@ -3,8 +3,11 @@
3
3
4 <annotation name="org.freedesktop.Accounts.VendorExtension" value="true"/>
4 <annotation name="org.freedesktop.Accounts.VendorExtension" value="true"/>
5
5
6+ <annotation name="org.freedesktop.Accounts.Authentication.ChangeOwn"
7+ value="com.canonical.unity.AccountsService.ModifyOwnUser"/>
8+
6 <annotation name="org.freedesktop.Accounts.Authentication.ChangeAny"
9 <annotation name="org.freedesktop.Accounts.Authentication.ChangeAny"
7− value="com.canonical.unity.AccountsService.ModifyUsers"/>
10+ value="com.canonical.unity.AccountsService.ModifyAnyUser"/>
8
11
9 <property name="demo-edges" type="b" access="readwrite">
12 <property name="demo-edges" type="b" access="readwrite">
10 <annotation name="org.freedesktop.Accounts.DefaultValue" value="true"/>
13 <annotation name="org.freedesktop.Accounts.DefaultValue" value="true"/>