[gnome-session] gsm: Enforce disable-user-switching lockdown setting
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] gsm: Enforce disable-user-switching lockdown setting
- Date: Tue, 22 Mar 2011 18:02:24 +0000 (UTC)
commit 899fe6b1628cd2d86931632f72512bca04d2aeaf
Author: Vincent Untz <vuntz gnome org>
Date: Tue Mar 22 19:01:42 2011 +0100
gsm: Enforce disable-user-switching lockdown setting
This part of https://bugzilla.gnome.org/show_bug.cgi?id=598255 but this
does not cover the UI yet.
gnome-session/gsm-manager.c | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index 79deef0..fc3539e 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -89,6 +89,7 @@
#define LOCKDOWN_SCHEMA "org.gnome.desktop.lockdown"
#define KEY_DISABLE_LOG_OUT "disable-log-out"
+#define KEY_DISABLE_USER_SWITCHING "disable-user-switching"
static void app_registered (GsmApp *app, GsmManager *manager);
@@ -181,7 +182,8 @@ static void gsm_manager_finalize (GObject *object);
static gboolean auto_save_is_enabled (GsmManager *manager);
static void maybe_save_session (GsmManager *manager);
-static gboolean _log_out_is_locked_down (GsmManager *manager);
+static gboolean _log_out_is_locked_down (GsmManager *manager);
+static gboolean _switch_user_is_locked_down (GsmManager *manager);
static void _handle_client_end_session_response (GsmManager *manager,
GsmClient *client,
@@ -1016,6 +1018,14 @@ manager_switch_user (GdkDisplay *display,
GAppLaunchContext *context;
GAppInfo *app;
+ /* We have to do this here and in request_switch_user() because this
+ * function can be called at a later time, not just directly after
+ * request_switch_user(). */
+ if (_switch_user_is_locked_down (manager)) {
+ g_warning ("Unable to switch user: User switching has been locked down");
+ return;
+ }
+
command = g_strdup_printf ("%s %s",
GDM_FLEXISERVER_COMMAND,
GDM_FLEXISERVER_ARGS);
@@ -2927,6 +2937,13 @@ request_switch_user (GdkDisplay *display,
{
g_debug ("GsmManager: requesting user switch");
+ /* See comment in manager_switch_user() to understand why we do this in
+ * both functions. */
+ if (_switch_user_is_locked_down (manager)) {
+ g_warning ("Unable to switch user: User switching has been locked down");
+ return;
+ }
+
if (! gsm_manager_is_switch_user_inhibited (manager)) {
manager_switch_user (display, manager);
return;
@@ -3194,6 +3211,13 @@ _log_out_is_locked_down (GsmManager *manager)
KEY_DISABLE_LOG_OUT);
}
+static gboolean
+_switch_user_is_locked_down (GsmManager *manager)
+{
+ return g_settings_get_boolean (manager->priv->lockdown_settings,
+ KEY_DISABLE_USER_SWITCHING);
+}
+
gboolean
gsm_manager_shutdown (GsmManager *manager,
GError **error)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]