Blame SOURCES/respect-lockscreen-lockdown.patch

f3cbb9
From 957e20baa7d82f532134e02ef54c8368c18cd76f Mon Sep 17 00:00:00 2001
f3cbb9
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
f3cbb9
Date: Fri, 17 Mar 2017 15:48:22 +0100
f3cbb9
Subject: [PATCH 1/2] screenShield: Do not lock the screen when locked down
f3cbb9
f3cbb9
When using the 'disable-lock-screen' setting to lock down the screen
f3cbb9
lock, the expectation is that users cannot lock the screen. However
f3cbb9
as it turns out, all the setting currently does is hiding the lock
f3cbb9
button in the system menu and making the lock settings in the privacy
f3cbb9
panel inactive. That means that if the 'lock-screen-enabled' setting
f3cbb9
isn't disabled and locked down as well, we will just continue to
f3cbb9
lock the screen on inactivity - not to mention the keyboard shortcut
f3cbb9
that isn't subject to that setting anyway.
f3cbb9
f3cbb9
Instead of expecting administrators to hunt down every possible way
f3cbb9
of locking the screen and disabling it individually, we can easily
f3cbb9
handle all cases by refusing to lock the screen when disabled by the
f3cbb9
lockdown settings.
f3cbb9
f3cbb9
https://bugzilla.gnome.org/show_bug.cgi?id=780212
f3cbb9
---
f3cbb9
 js/ui/screenShield.js | 10 ++++++++++
f3cbb9
 1 file changed, 10 insertions(+)
f3cbb9
f3cbb9
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
f3cbb9
index 3d55375b0..0d822353a 100644
f3cbb9
--- a/js/ui/screenShield.js
f3cbb9
+++ b/js/ui/screenShield.js
f3cbb9
@@ -33,6 +33,9 @@ const SCREENSAVER_SCHEMA = 'org.gnome.desktop.screensaver';
f3cbb9
 const LOCK_ENABLED_KEY = 'lock-enabled';
f3cbb9
 const LOCK_DELAY_KEY = 'lock-delay';
f3cbb9
 
f3cbb9
+const LOCKDOWN_SCHEMA = 'org.gnome.desktop.lockdown';
f3cbb9
+const DISABLE_LOCK_KEY = 'disable-lock-screen';
f3cbb9
+
f3cbb9
 const LOCKED_STATE_STR = 'screenShield.locked';
f3cbb9
 // fraction of screen height the arrow must reach before completing
f3cbb9
 // the slide up automatically
f3cbb9
@@ -543,6 +546,8 @@ const ScreenShield = new Lang.Class({
f3cbb9
         this._settings = new Gio.Settings({ schema_id: SCREENSAVER_SCHEMA });
f3cbb9
         this._settings.connect('changed::' + LOCK_ENABLED_KEY, Lang.bind(this, this._syncInhibitor));
f3cbb9
 
f3cbb9
+        this._lockSettings = new Gio.Settings({ schema_id: LOCKDOWN_SCHEMA });
f3cbb9
+
f3cbb9
         this._isModal = false;
f3cbb9
         this._hasLockScreen = false;
f3cbb9
         this._isGreeter = false;
f3cbb9
@@ -1289,6 +1294,11 @@ const ScreenShield = new Lang.Class({
f3cbb9
     },
f3cbb9
 
f3cbb9
     lock: function(animate) {
f3cbb9
+        if (this._lockSettings.get_boolean(DISABLE_LOCK_KEY)) {
f3cbb9
+            log('Screen lock is locked down, not locking') // lock, lock - who's there?
f3cbb9
+            return;
f3cbb9
+        }
f3cbb9
+
f3cbb9
         // Warn the user if we can't become modal
f3cbb9
         if (!this._becomeModal()) {
f3cbb9
             Main.notifyError(_("Unable to lock"),
f3cbb9
-- 
f3cbb9
2.12.0
f3cbb9
f3cbb9
f3cbb9
From 4ff403d64d44b220824122601656db847f0c1a7b Mon Sep 17 00:00:00 2001
f3cbb9
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
f3cbb9
Date: Fri, 17 Mar 2017 15:48:22 +0100
f3cbb9
Subject: [PATCH 2/2] screenShield: Do not take an inhibitor when disabled by
f3cbb9
 lockdown
f3cbb9
f3cbb9
Just as with the normal lock screen settings, we shouldn't request
f3cbb9
a logind inhibitor when locking is disabled via lockdown settings.
f3cbb9
f3cbb9
https://bugzilla.gnome.org/show_bug.cgi?id=780212
f3cbb9
---
f3cbb9
 js/ui/screenShield.js | 5 ++++-
f3cbb9
 1 file changed, 4 insertions(+), 1 deletion(-)
f3cbb9
f3cbb9
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
f3cbb9
index 0d822353a..f6382d28f 100644
f3cbb9
--- a/js/ui/screenShield.js
f3cbb9
+++ b/js/ui/screenShield.js
f3cbb9
@@ -547,6 +547,7 @@ const ScreenShield = new Lang.Class({
f3cbb9
         this._settings.connect('changed::' + LOCK_ENABLED_KEY, Lang.bind(this, this._syncInhibitor));
f3cbb9
 
f3cbb9
         this._lockSettings = new Gio.Settings({ schema_id: LOCKDOWN_SCHEMA });
f3cbb9
+        this._lockSettings.connect('changed::' + DISABLE_LOCK_KEY, Lang.bind(this, this._syncInhibitor));
f3cbb9
 
f3cbb9
         this._isModal = false;
f3cbb9
         this._hasLockScreen = false;
f3cbb9
@@ -705,8 +706,10 @@ const ScreenShield = new Lang.Class({
f3cbb9
     },
f3cbb9
 
f3cbb9
     _syncInhibitor: function() {
f3cbb9
+        let lockEnabled = this._settings.get_boolean(LOCK_ENABLED_KEY);
f3cbb9
+        let lockLocked = this._lockSettings.get_boolean(DISABLE_LOCK_KEY);
f3cbb9
         let inhibit = (this._loginSession && this._loginSession.Active &&
f3cbb9
-                       !this._isActive && this._settings.get_boolean(LOCK_ENABLED_KEY));
f3cbb9
+                       !this._isActive && lockEnabled && !lockLocked);
f3cbb9
         if (inhibit) {
f3cbb9
             this._loginManager.inhibit(_("GNOME needs to lock the screen"),
f3cbb9
                                        Lang.bind(this, function(inhibitor) {
f3cbb9
-- 
f3cbb9
2.12.0
f3cbb9