unlockDialog: Honor switch user lockdown settings

At the moment user switching functionality is controlled by two
settings:

org.gnome.desktop.lockdown disable-user-switching

for the panel when the session is unlocked, and

org.gnome.desktop.screensaver user-switch-enabled

for the unlock dialog when the session is locked.

Having the lockdown setting not apply when the screen is
locked is counterintuitive.

This commit makes the unlock dialog honor both settings.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1833>
This commit is contained in:
Ray Strode 2021-05-06 09:32:48 -04:00
parent c17601bdee
commit 118d556991

View File

@ -577,6 +577,10 @@ var UnlockDialog = GObject.registerClass({
this._userSwitchEnabledId = this._screenSaverSettings.connect('changed::user-switch-enabled',
this._updateUserSwitchVisibility.bind(this));
this._lockdownSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.lockdown' });
this._lockdownSettings.connect('changed::disable-user-switching',
this._updateUserSwitchVisibility.bind(this));
this._userLoadedId = this._user.connect('notify::is-loaded',
this._updateUserSwitchVisibility.bind(this));
@ -858,7 +862,8 @@ var UnlockDialog = GObject.registerClass({
_updateUserSwitchVisibility() {
this._otherUserButton.visible = this._userManager.can_switch() &&
this._screenSaverSettings.get_boolean('user-switch-enabled');
this._screenSaverSettings.get_boolean('user-switch-enabled') &&
!this._lockdownSettings.get_boolean('disable-user-switching');
}
cancel() {