|
|
1bd53d |
From 4024d59871d0c8990ef5e4243c9fc485971755e7 Mon Sep 17 00:00:00 2001
|
|
|
1bd53d |
From: Ray Strode <rstrode@redhat.com>
|
|
|
1bd53d |
Date: Tue, 10 Aug 2021 13:25:57 -0400
|
|
|
1bd53d |
Subject: [PATCH 1/3] extensionSystem: Get rid of _enabled boolean optimization
|
|
|
1bd53d |
|
|
|
1bd53d |
At the moment a session mode either allows extensions or it doesn't.
|
|
|
1bd53d |
If it allows extensions, then the entire available list of
|
|
|
1bd53d |
configured extensions get enabled as soon as the session mode is
|
|
|
1bd53d |
entered.
|
|
|
1bd53d |
|
|
|
1bd53d |
Since enabling or disabling extensions is an all or nothing situation,
|
|
|
1bd53d |
the code tracks whether extensions are already enabled when entering
|
|
|
1bd53d |
the session mode, and if so, avoids iterating through the extension list
|
|
|
1bd53d |
needlessly. It does this using a boolean named _enabled.
|
|
|
1bd53d |
|
|
|
1bd53d |
In the future, the extensions themselves will be given some say on
|
|
|
1bd53d |
whether or not they should be enabled in a given session mode. This
|
|
|
1bd53d |
means, the configured extension list may contain extensions that
|
|
|
1bd53d |
shouldn't be enabled for a given session mode, and the _enabled boolean
|
|
|
1bd53d |
will no longer be appropriated.
|
|
|
1bd53d |
|
|
|
1bd53d |
This commit drops the _enabled boolean optimization.
|
|
|
1bd53d |
---
|
|
|
1bd53d |
js/ui/extensionSystem.js | 10 ----------
|
|
|
1bd53d |
1 file changed, 10 deletions(-)
|
|
|
1bd53d |
|
|
|
1bd53d |
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
|
|
|
1bd53d |
index 9f4eb757b..2aae44b53 100644
|
|
|
1bd53d |
--- a/js/ui/extensionSystem.js
|
|
|
1bd53d |
+++ b/js/ui/extensionSystem.js
|
|
|
1bd53d |
@@ -23,7 +23,6 @@ const UPDATE_CHECK_TIMEOUT = 24 * 60 * 60; // 1 day in seconds
|
|
|
1bd53d |
var ExtensionManager = class {
|
|
|
1bd53d |
constructor() {
|
|
|
1bd53d |
this._initialized = false;
|
|
|
1bd53d |
- this._enabled = false;
|
|
|
1bd53d |
this._updateNotified = false;
|
|
|
1bd53d |
|
|
|
1bd53d |
this._extensions = new Map();
|
|
|
1bd53d |
@@ -597,9 +596,6 @@ var ExtensionManager = class {
|
|
|
1bd53d |
}
|
|
|
1bd53d |
|
|
|
1bd53d |
_enableAllExtensions() {
|
|
|
1bd53d |
- if (this._enabled)
|
|
|
1bd53d |
- return;
|
|
|
1bd53d |
-
|
|
|
1bd53d |
if (!this._initialized) {
|
|
|
1bd53d |
this._loadExtensions();
|
|
|
1bd53d |
this._initialized = true;
|
|
|
1bd53d |
@@ -608,20 +604,14 @@ var ExtensionManager = class {
|
|
|
1bd53d |
this._callExtensionEnable(uuid);
|
|
|
1bd53d |
});
|
|
|
1bd53d |
}
|
|
|
1bd53d |
- this._enabled = true;
|
|
|
1bd53d |
}
|
|
|
1bd53d |
|
|
|
1bd53d |
_disableAllExtensions() {
|
|
|
1bd53d |
- if (!this._enabled)
|
|
|
1bd53d |
- return;
|
|
|
1bd53d |
-
|
|
|
1bd53d |
if (this._initialized) {
|
|
|
1bd53d |
this._extensionOrder.slice().reverse().forEach(uuid => {
|
|
|
1bd53d |
this._callExtensionDisable(uuid);
|
|
|
1bd53d |
});
|
|
|
1bd53d |
}
|
|
|
1bd53d |
-
|
|
|
1bd53d |
- this._enabled = false;
|
|
|
1bd53d |
}
|
|
|
1bd53d |
|
|
|
1bd53d |
_sessionUpdated() {
|
|
|
1bd53d |
--
|
|
|
1bd53d |
2.33.1
|
|
|
1bd53d |
|
|
|
1bd53d |
|
|
|
1bd53d |
From f883c3f87f9778a0c2ed34db648aad73668949e3 Mon Sep 17 00:00:00 2001
|
|
|
1bd53d |
From: Ray Strode <rstrode@redhat.com>
|
|
|
1bd53d |
Date: Sat, 28 Aug 2021 13:54:39 -0400
|
|
|
1bd53d |
Subject: [PATCH 2/3] extensionSystem: Allow extensions to run on the login
|
|
|
1bd53d |
screen
|
|
|
1bd53d |
|
|
|
1bd53d |
At the moment it's not realy possible to extend the login screen to do
|
|
|
1bd53d |
things it doesn't have built-in support for. This means in order
|
|
|
1bd53d |
to support niche use cases, those cases have to change the main
|
|
|
1bd53d |
code base. For instance, oVirt and Vmware deployments want to be able
|
|
|
1bd53d |
to automaticaly log in guest VMs when a user pre-authenticates through a
|
|
|
1bd53d |
console on a management host. To support those use cases, we added
|
|
|
1bd53d |
code to the login screen directly, even though most machines will never
|
|
|
1bd53d |
be associated with oVirt or Vmware management hosts.
|
|
|
1bd53d |
|
|
|
1bd53d |
We also get requests from e.g. government users that need certain features
|
|
|
1bd53d |
at the login screen that wouldn't get used much outside of government
|
|
|
1bd53d |
deployments. For instance, we've gotten requests that a machine contains
|
|
|
1bd53d |
prominently displays that it has "Top Secret" information.
|
|
|
1bd53d |
|
|
|
1bd53d |
All of these use cases seem like they would better handled via
|
|
|
1bd53d |
extensions that could be installed in the specific deployments. The
|
|
|
1bd53d |
problem is extensions only run in the user session, and get
|
|
|
1bd53d |
disabled at the login screen automatically.
|
|
|
1bd53d |
|
|
|
1bd53d |
This commit changes that. Now extensions can specify in their metadata
|
|
|
1bd53d |
via a new sessionModes property, which modes that want to run in. For
|
|
|
1bd53d |
backward compatibility, if an extension doesn't specify which session
|
|
|
1bd53d |
modes it works in, its assumed the extension only works in the user
|
|
|
1bd53d |
session.
|
|
|
1bd53d |
---
|
|
|
1bd53d |
js/ui/extensionSystem.js | 33 +++++++++++++++++++++++++++++----
|
|
|
1bd53d |
1 file changed, 29 insertions(+), 4 deletions(-)
|
|
|
1bd53d |
|
|
|
1bd53d |
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
|
|
|
1bd53d |
index 2aae44b53..937f86199 100644
|
|
|
1bd53d |
--- a/js/ui/extensionSystem.js
|
|
|
1bd53d |
+++ b/js/ui/extensionSystem.js
|
|
|
1bd53d |
@@ -75,6 +75,28 @@ var ExtensionManager = class {
|
|
|
1bd53d |
return [...this._extensions.keys()];
|
|
|
1bd53d |
}
|
|
|
1bd53d |
|
|
|
1bd53d |
+ _extensionSupportsSessionMode(uuid) {
|
|
|
1bd53d |
+ const extension = this.lookup(uuid);
|
|
|
1bd53d |
+ if (!extension)
|
|
|
1bd53d |
+ return false;
|
|
|
1bd53d |
+
|
|
|
1bd53d |
+ if (extension.sessionModes.includes(Main.sessionMode.currentMode))
|
|
|
1bd53d |
+ return true;
|
|
|
1bd53d |
+ if (extension.sessionModes.includes(Main.sessionMode.parentMode))
|
|
|
1bd53d |
+ return true;
|
|
|
1bd53d |
+ return false;
|
|
|
1bd53d |
+ }
|
|
|
1bd53d |
+
|
|
|
1bd53d |
+ _sessionModeCanUseExtension(uuid) {
|
|
|
1bd53d |
+ if (!Main.sessionMode.allowExtensions)
|
|
|
1bd53d |
+ return false;
|
|
|
1bd53d |
+
|
|
|
1bd53d |
+ if (!this._extensionSupportsSessionMode(uuid))
|
|
|
1bd53d |
+ return false;
|
|
|
1bd53d |
+
|
|
|
1bd53d |
+ return true;
|
|
|
1bd53d |
+ }
|
|
|
1bd53d |
+
|
|
|
1bd53d |
_callExtensionDisable(uuid) {
|
|
|
1bd53d |
let extension = this.lookup(uuid);
|
|
|
1bd53d |
if (!extension)
|
|
|
1bd53d |
@@ -134,7 +156,7 @@ var ExtensionManager = class {
|
|
|
1bd53d |
}
|
|
|
1bd53d |
|
|
|
1bd53d |
_callExtensionEnable(uuid) {
|
|
|
1bd53d |
- if (!Main.sessionMode.allowExtensions)
|
|
|
1bd53d |
+ if (!this._sessionModeCanUseExtension(uuid))
|
|
|
1bd53d |
return;
|
|
|
1bd53d |
|
|
|
1bd53d |
let extension = this.lookup(uuid);
|
|
|
1bd53d |
@@ -316,6 +338,7 @@ var ExtensionManager = class {
|
|
|
1bd53d |
hasPrefs: dir.get_child('prefs.js').query_exists(null),
|
|
|
1bd53d |
hasUpdate: false,
|
|
|
1bd53d |
canChange: false,
|
|
|
1bd53d |
+ sessionModes: meta['session-modes'] ? meta['session-modes'] : [ 'user' ],
|
|
|
1bd53d |
};
|
|
|
1bd53d |
this._extensions.set(uuid, extension);
|
|
|
1bd53d |
|
|
|
1bd53d |
@@ -398,7 +421,7 @@ var ExtensionManager = class {
|
|
|
1bd53d |
}
|
|
|
1bd53d |
|
|
|
1bd53d |
_callExtensionInit(uuid) {
|
|
|
1bd53d |
- if (!Main.sessionMode.allowExtensions)
|
|
|
1bd53d |
+ if (!this._sessionModeCanUseExtension(uuid))
|
|
|
1bd53d |
return false;
|
|
|
1bd53d |
|
|
|
1bd53d |
let extension = this.lookup(uuid);
|
|
|
1bd53d |
@@ -487,13 +510,15 @@ var ExtensionManager = class {
|
|
|
1bd53d |
// Find and enable all the newly enabled extensions: UUIDs found in the
|
|
|
1bd53d |
// new setting, but not in the old one.
|
|
|
1bd53d |
newEnabledExtensions
|
|
|
1bd53d |
- .filter(uuid => !this._enabledExtensions.includes(uuid))
|
|
|
1bd53d |
+ .filter(uuid => !this._enabledExtensions.includes(uuid) &&
|
|
|
1bd53d |
+ this._extensionSupportsSessionMode(uuid))
|
|
|
1bd53d |
.forEach(uuid => this._callExtensionEnable(uuid));
|
|
|
1bd53d |
|
|
|
1bd53d |
// Find and disable all the newly disabled extensions: UUIDs found in the
|
|
|
1bd53d |
// old setting, but not in the new one.
|
|
|
1bd53d |
this._extensionOrder
|
|
|
1bd53d |
- .filter(uuid => !newEnabledExtensions.includes(uuid))
|
|
|
1bd53d |
+ .filter(uuid => !newEnabledExtensions.includes(uuid) ||
|
|
|
1bd53d |
+ !this._extensionSupportsSessionMode(uuid))
|
|
|
1bd53d |
.reverse().forEach(uuid => this._callExtensionDisable(uuid));
|
|
|
1bd53d |
|
|
|
1bd53d |
this._enabledExtensions = newEnabledExtensions;
|
|
|
1bd53d |
--
|
|
|
1bd53d |
2.33.1
|
|
|
1bd53d |
|
|
|
1bd53d |
|
|
|
1bd53d |
From c637d0a14ea7223ea7d763e1c4dedb4d6b6609a4 Mon Sep 17 00:00:00 2001
|
|
|
1bd53d |
From: Ray Strode <rstrode@redhat.com>
|
|
|
1bd53d |
Date: Tue, 10 Aug 2021 15:31:00 -0400
|
|
|
1bd53d |
Subject: [PATCH 3/3] sessionMode: Allow extensions at the login and unlock
|
|
|
1bd53d |
screens
|
|
|
1bd53d |
|
|
|
1bd53d |
Now extensions can specify which session modes they work in,
|
|
|
1bd53d |
but specifying the login screen or unlock screen session modes in
|
|
|
1bd53d |
an extensions metadata still won't work, because those session
|
|
|
1bd53d |
modes disallow extensions.
|
|
|
1bd53d |
|
|
|
1bd53d |
This commit fixes that.
|
|
|
1bd53d |
---
|
|
|
1bd53d |
js/ui/sessionMode.js | 2 ++
|
|
|
1bd53d |
1 file changed, 2 insertions(+)
|
|
|
1bd53d |
|
|
|
1bd53d |
diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js
|
|
|
1bd53d |
index 4d4fb2444..0534fd1d4 100644
|
|
|
1bd53d |
--- a/js/ui/sessionMode.js
|
|
|
1bd53d |
+++ b/js/ui/sessionMode.js
|
|
|
1bd53d |
@@ -43,6 +43,7 @@ const _modes = {
|
|
|
1bd53d |
},
|
|
|
1bd53d |
|
|
|
1bd53d |
'gdm': {
|
|
|
1bd53d |
+ allowExtensions: true,
|
|
|
1bd53d |
hasNotifications: true,
|
|
|
1bd53d |
isGreeter: true,
|
|
|
1bd53d |
isPrimary: true,
|
|
|
1bd53d |
@@ -59,6 +60,7 @@ const _modes = {
|
|
|
1bd53d |
},
|
|
|
1bd53d |
|
|
|
1bd53d |
'unlock-dialog': {
|
|
|
1bd53d |
+ allowExtensions: true,
|
|
|
1bd53d |
isLocked: true,
|
|
|
1bd53d |
unlockDialog: undefined,
|
|
|
1bd53d |
components: ['polkitAgent', 'telepathyClient'],
|
|
|
1bd53d |
--
|
|
|
1bd53d |
2.33.1
|
|
|
1bd53d |
|