1
From 6747d98264646f123b6da33f36e063eeb5f1fe4a Mon Sep 17 00:00:00 2001
2
From: Aaron Seigo <aseigo@kde.org>
3
Date: Fri, 16 Sep 2011 13:29:00 +0200
4
Subject: [PATCH 23/31] fix kiosk restrictions for user switching and logout
6
it was using authorizeKAction, which means the keys would be "action/logout" while documentation
7
clearly states it is just "logout". that is now fixed, including keeping support for "action/logout"
8
so as not to break existing configurations.
10
switch_user simply wasn't being checked at all, now it is.
12
plasma/desktop/applets/kickoff/core/leavemodel.cpp | 15 +++++++++------
13
1 files changed, 9 insertions(+), 6 deletions(-)
15
diff --git a/plasma/desktop/applets/kickoff/core/leavemodel.cpp b/plasma/desktop/applets/kickoff/core/leavemodel.cpp
16
index bf89932..7a7e4c6 100644
17
--- a/plasma/desktop/applets/kickoff/core/leavemodel.cpp
18
+++ b/plasma/desktop/applets/kickoff/core/leavemodel.cpp
19
@@ -118,19 +118,20 @@ void LeaveModel::updateModel()
20
QStandardItem *sessionOptions = new QStandardItem(i18n("Session"));
23
- if ( KAuthorized::authorizeKAction( "logout" ) ) {
24
+ const bool canLogout = KAuthorized::authorizeKAction("logout") && KAuthorized::authorize("logout");
26
QStandardItem *logoutOption = createStandardItem("leave:/logoutonly");
27
sessionOptions->appendRow(logoutOption);
31
- if ( KAuthorized::authorizeKAction( "lock_screen" ) ) {
32
+ if (KAuthorized::authorizeKAction("lock_screen") && KAuthorized::authorize("logout")) {
33
QStandardItem *lockOption = createStandardItem("leave:/lock");
34
sessionOptions->appendRow(lockOption);
38
- if ( KAuthorized::authorizeKAction( "logout" ) ) {
40
KConfigGroup c(KSharedConfig::openConfig("ksmserverrc", KConfig::NoGlobals), "General");
41
if (c.readEntry("loginMode") == "restoreSavedSession") {
42
QStandardItem *saveSessionOption = createStandardItem("leave:/savesession");
43
@@ -139,8 +140,10 @@ void LeaveModel::updateModel()
47
- QStandardItem *switchUserOption = createStandardItem("leave:/switch");
48
- sessionOptions->appendRow(switchUserOption);
49
+ if (KAuthorized::authorize(QLatin1String("switch_user"))) {
50
+ QStandardItem *switchUserOption = createStandardItem("leave:/switch");
51
+ sessionOptions->appendRow(switchUserOption);
55
QStandardItem *systemOptions = new QStandardItem(i18n("System"));
56
@@ -148,7 +151,7 @@ void LeaveModel::updateModel()
58
//FIXME: the proper fix is to implement the KWorkSpace methods for Windows
60
- if ( KAuthorized::authorizeKAction( "logout" ) ) {
62
QSet< Solid::PowerManagement::SleepState > spdMethods = Solid::PowerManagement::supportedSleepStates();
63
if (spdMethods.contains(Solid::PowerManagement::StandbyState)) {
64
QStandardItem *standbyOption = createStandardItem("leave:/standby");