on xenial help sign in
Fix accounts-service/policykit interaction
commite88422363825b6b3f3e4e1ad81fbb9b32053be51 authorMichael Terry <michael.terry@canonical.com> dateMon 12 Aug 2013, 14:41 (13 years ago) parentfbbd0a0
8 files changed+42−22
Shell.qml+2−2 debian/unity8-private.install+1 plugins/AccountsService/50-com.canonical.unity.AccountsService.pkla+6 plugins/AccountsService/AccountsService.cpp+4−3 plugins/AccountsService/CMakeLists.txt+9−6 plugins/AccountsService/com.canonical.unity.AccountsService.policy+16−5 plugins/AccountsService/com.canonical.unity.AccountsService.rules−5 plugins/AccountsService/com.canonical.unity.AccountsService.xml+4−1
Shell.qml+2−2
@@ -59,7 +59,7 @@ FocusScope {
5959 }
6060 }
6161
62− property bool showEdgeDemo: true
62+ property bool showEdgeDemo: false
6363 property bool showEdgeDemoInGreeter: showEdgeDemo //AccountsService.getUserProperty("lightdm", "demo-edges")
6464
6565 function hideEdgeDemo() {
@@ -494,7 +494,7 @@ FocusScope {
494494 shell.background = bgPath ? bgPath : default_background
495495 // Update edge demo hint
496496 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")
498498 }
499499
500500 onLeftTeaserPressedChanged: {
debian/unity8-private.install+1
@@ -9,3 +9,4 @@ usr/lib/*/unity8/qml/Utils
99usr/share/accountsservice/interfaces
1010usr/share/dbus-1/interfaces
1111usr/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 @@
1717 */
1818
1919#include "AccountsService.h"
20−#include <QtCore/QEvent>
21−#include <QtDBus/QDBusPendingReply>
20+#include <QtDBus/QDBusConnection>
21+#include <QtDBus/QDBusMessage>
22+#include <QtDBus/QDBusVariant>
2223
2324AccountsService::AccountsService(QObject* parent)
2425 : QObject(parent),
@@ -47,7 +48,7 @@ void AccountsService::setUserProperty(const QString &user, const QString &proper
4748{
4849 auto iface = getUserInterface(user);
4950 if (iface != nullptr && iface->isValid()) {
50− // The value needs to be carefully wrapped thrice
51+ // The value needs to be carefully wrapped
5152 iface->call("Set", "com.canonical.unity.AccountsService", property, QVariant::fromValue(QDBusVariant(value)));
5253 }
5354}
plugins/AccountsService/CMakeLists.txt+9−6
@@ -12,7 +12,10 @@ qt5_use_modules(AccountsService-qml DBus Qml)
1212export_qmlfiles(AccountsService AccountsService)
1313export_qmlplugin(AccountsService 0.1 AccountsService TARGETS AccountsService-qml)
1414
15−set(POLICYKIT_DIR "${CMAKE_INSTALL_PREFIX}/share/polkit-1")
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")
18+set(POLKIT_DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/polkit-1")
1619set(DBUS_IFACE_DIR "${CMAKE_INSTALL_PREFIX}/share/dbus-1/interfaces")
1720set(ACCOUNTS_IFACE_DIR "${CMAKE_INSTALL_PREFIX}/share/accountsservice/interfaces")
1821
@@ -22,14 +25,14 @@ install(FILES com.canonical.unity.AccountsService.xml
2225
2326# Create accountsservice symlink for above dbus interface
2427install(CODE "
25−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}\")
28+execute_process(COMMAND mkdir -p \"\$ENV{DESTDIR}${ACCOUNTS_IFACE_DIR}\")
29+execute_process(COMMAND ln -sf ../../dbus-1/interfaces/com.canonical.unity.AccountsService.xml \"\$ENV{DESTDIR}${ACCOUNTS_IFACE_DIR}\")
2730 ")
2831
2932install(FILES com.canonical.unity.AccountsService.policy
30− DESTINATION "${POLICYKIT_DIR}/actions"
33+ DESTINATION "${POLKIT_DATA_DIR}/actions"
3134 )
3235
33−install(FILES com.canonical.unity.AccountsService.rules
34− DESTINATION "${POLICYKIT_DIR}/rules.d"
36+install(FILES 50-com.canonical.unity.AccountsService.pkla
37+ DESTINATION "${POLKIT_LIB_DIR}/localauthority/10-vendor.d"
3538 )
plugins/AccountsService/com.canonical.unity.AccountsService.policy+16−5
@@ -1,13 +1,24 @@
11<?xml version="1.0" encoding="UTF-8"?>
22
33<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">
515 <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>
718 <defaults>
8− <allow_any>auth_admin_keep</allow_any>
9− <allow_inactive>auth_admin_keep</allow_inactive>
10− <allow_active>auth_admin_keep</allow_active>
19+ <allow_any>no</allow_any>
20+ <allow_inactive>no</allow_inactive>
21+ <allow_active>no</allow_active>
1122 </defaults>
1223 </action>
1324</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 @@
33
44 <annotation name="org.freedesktop.Accounts.VendorExtension" value="true"/>
55
6+ <annotation name="org.freedesktop.Accounts.Authentication.ChangeOwn"
7+ value="com.canonical.unity.AccountsService.ModifyOwnUser"/>
8+
69 <annotation name="org.freedesktop.Accounts.Authentication.ChangeAny"
7− value="com.canonical.unity.AccountsService.ModifyUsers"/>
10+ value="com.canonical.unity.AccountsService.ModifyAnyUser"/>
811
912 <property name="demo-edges" type="b" access="readwrite">
1013 <annotation name="org.freedesktop.Accounts.DefaultValue" value="true"/>