settings: enforce administrator-managed lock settings (#3897)

port 2.0

(cherry picked from commit 404c9672d7)
This commit is contained in:
alvarosth authored and dux-ci[bot] committed 2026-10-26 17:41:50 +00:00
1 parent 4e0985fbbb
commit 5ef5a7391b
18 files changed
+526 -56

No files matched your search

+15 -9
View File
@@ -34,6 +34,7 @@ Item {
property string u2fPendingApplyPath: ""
property bool u2fShowCustom: false
readonly property string managedNote: I18n.tr("Managed by administrator policy", "settings note: the administrator lock policy sets this value")
readonly property string authAutoLabel: I18n.tr("Auto", "automatic PAM authentication source option")
readonly property string authCustomLabel: I18n.tr("Custom", "custom PAM authentication source option") + "…"
@@ -416,6 +417,8 @@ Item {
settingKey: "lockAtStartup"
tags: ["lock", "screen", "startup", "start", "boot", "login", "automatic"]
text: I18n.tr("Lock at startup")
description: SettingsData.isManaged("lockAtStartup") ? root.managedNote : ""
enabled: !SettingsData.isManaged("lockAtStartup")
checked: SettingsData.lockAtStartup
onToggled: checked => SettingsData.set("lockAtStartup", checked)
}
@@ -424,6 +427,8 @@ Item {
settingKey: "lockBeforeSuspend"
tags: ["lock", "screen", "suspend", "hibernate", "sleep", "automatic"]
text: I18n.tr("Lock before suspend")
description: SettingsData.isManaged("lockBeforeSuspend") ? root.managedNote : ""
enabled: !SettingsData.isManaged("lockBeforeSuspend")
checked: SettingsData.lockBeforeSuspend
visible: SessionService.loginctlAvailable && SettingsData.loginctlLockIntegration
onToggled: checked => SettingsData.set("lockBeforeSuspend", checked)
@@ -499,10 +504,10 @@ Item {
settingKey: "enableFprint"
tags: ["lock", "screen", "fingerprint", "authentication", "biometric", "fprint"]
text: I18n.tr("Fingerprint", "lock screen fingerprint authentication toggle")
description: root.lockFprintControlledByPrimary ? I18n.tr("Managed by the primary PAM source", "factor managed by PAM source status") : root.lockFingerprintDescription()
descriptionColor: root.lockFprintControlledByPrimary || SettingsData.lockFingerprintReason === "ready" ? Theme.surfaceVariantText : Theme.warning
description: SettingsData.isManaged("enableFprint") ? root.managedNote : root.lockFprintControlledByPrimary ? I18n.tr("Managed by the primary PAM source", "factor managed by PAM source status") : root.lockFingerprintDescription()
descriptionColor: SettingsData.isManaged("enableFprint") || root.lockFprintControlledByPrimary || SettingsData.lockFingerprintReason === "ready" ? Theme.surfaceVariantText : Theme.warning
checked: SettingsData.enableFprint || root.primaryPamHasFprint
enabled: root.lockFprintToggleAvailable && !root.lockFprintControlledByPrimary
enabled: root.lockFprintToggleAvailable && !root.lockFprintControlledByPrimary && !SettingsData.isManaged("enableFprint")
onToggled: checked => SettingsData.set("enableFprint", checked)
}
@@ -510,10 +515,10 @@ Item {
settingKey: "enableU2f"
tags: ["lock", "screen", "u2f", "yubikey", "security", "key", "fido", "authentication", "hardware"]
text: I18n.tr("Security key")
description: root.lockU2fControlledByPrimary ? I18n.tr("Managed by the primary PAM source", "factor managed by PAM source status") : root.lockU2fDescription()
descriptionColor: root.lockU2fControlledByPrimary || SettingsData.lockU2fReason === "ready" ? Theme.surfaceVariantText : Theme.warning
description: SettingsData.isManaged("enableU2f") ? root.managedNote : root.lockU2fControlledByPrimary ? I18n.tr("Managed by the primary PAM source", "factor managed by PAM source status") : root.lockU2fDescription()
descriptionColor: SettingsData.isManaged("enableU2f") || root.lockU2fControlledByPrimary || SettingsData.lockU2fReason === "ready" ? Theme.surfaceVariantText : Theme.warning
checked: SettingsData.enableU2f || root.primaryPamHasU2f
enabled: root.lockU2fToggleAvailable && !root.lockU2fControlledByPrimary
enabled: root.lockU2fToggleAvailable && !root.lockU2fControlledByPrimary && !SettingsData.isManaged("enableU2f")
onToggled: checked => SettingsData.set("enableU2f", checked)
}
@@ -521,7 +526,8 @@ Item {
settingKey: "u2fMode"
tags: ["lock", "screen", "u2f", "yubikey", "security", "key", "mode", "factor", "second"]
text: I18n.tr("Security key mode", "lock screen U2F security key mode setting")
description: I18n.tr("'Alternative' lets the key unlock on its own. 'Second factor' requires password or fingerprint first, then the key.", "lock screen U2F security key mode setting")
description: SettingsData.isManaged("u2fMode") ? root.managedNote : I18n.tr("'Alternative' lets the key unlock on its own. 'Second factor' requires password or fingerprint first, then the key.", "lock screen U2F security key mode setting")
enabled: !SettingsData.isManaged("u2fMode")
visible: SettingsData.enableU2f && !root.lockU2fControlledByPrimary
options: [I18n.tr("Alternative (OR)", "U2F mode option: key works as standalone unlock method"), I18n.tr("Second factor (AND)", "U2F mode option: key required after password or fingerprint")]
currentValue: SettingsData.u2fMode === "and" ? I18n.tr("Second factor (AND)", "U2F mode option: key required after password or fingerprint") : I18n.tr("Alternative (OR)", "U2F mode option: key works as standalone unlock method")
@@ -852,9 +858,9 @@ Item {
settingKey: "loginctlLockIntegration"
tags: ["lock", "screen", "loginctl", "dbus", "integration", "external"]
text: I18n.tr("loginctl integration")
description: I18n.tr("Disable when using an external lock screen")
description: SettingsData.isManaged("loginctlLockIntegration") ? root.managedNote : I18n.tr("Disable when using an external lock screen")
checked: SessionService.loginctlAvailable && SettingsData.loginctlLockIntegration
enabled: SessionService.loginctlAvailable
enabled: SessionService.loginctlAvailable && !SettingsData.isManaged("loginctlLockIntegration")
onToggled: checked => {
if (!SessionService.loginctlAvailable)
return;
+11 -1
View File
@@ -15,6 +15,7 @@ Item {
readonly property var timeoutOptions: timeoutValues.map(seconds => seconds === 0 ? I18n.tr("Never", "timeout option meaning the action never happens") : I18n.duration(seconds))
readonly property var gracePeriodValues: [1, 2, 3, 4, 5, 10, 15, 20, 30]
readonly property var gracePeriodOptions: gracePeriodValues.map(seconds => I18n.duration(seconds))
readonly property string managedNote: I18n.tr("Managed by administrator policy", "settings note: the administrator lock policy sets this value")
function sourceKey(suffix) {
return (onAc ? "ac" : "battery") + suffix;
@@ -70,6 +71,8 @@ Item {
settingKey: "lockTimeout"
tags: ["lock", "timeout", "idle", "automatic", "security"]
text: I18n.tr("Automatically lock after")
description: SettingsData.isManaged(root.sourceKey("LockTimeout")) ? root.managedNote : ""
enabled: !SettingsData.isManaged(root.sourceKey("LockTimeout"))
resetKeys: [root.sourceKey("LockTimeout")]
options: root.timeoutOptions
currentValue: root.timeoutText(root.sourceKey("LockTimeout"))
@@ -126,6 +129,8 @@ Item {
settingKey: "lockBeforeSuspend"
tags: ["lock", "suspend", "hibernate", "sleep", "security"]
text: I18n.tr("Lock before suspend")
description: SettingsData.isManaged("lockBeforeSuspend") ? root.managedNote : ""
enabled: !SettingsData.isManaged("lockBeforeSuspend")
checked: SettingsData.lockBeforeSuspend
visible: SessionService.loginctlAvailable && SettingsData.loginctlLockIntegration
onToggled: checked => SettingsData.set("lockBeforeSuspend", checked)
@@ -143,7 +148,8 @@ Item {
settingKey: "fadeToLockEnabled"
tags: ["fade", "lock", "screen", "idle", "grace period"]
text: I18n.tr("Fade to lock screen")
description: I18n.tr("Fades the screen out first. Input during the fade cancels it", "idle fade toggle description")
description: SettingsData.isManaged("fadeToLockEnabled") ? root.managedNote : I18n.tr("Fades the screen out first. Input during the fade cancels it", "idle fade toggle description")
enabled: !SettingsData.isManaged("fadeToLockEnabled")
checked: SettingsData.fadeToLockEnabled
onToggled: checked => SettingsData.set("fadeToLockEnabled", checked)
}
@@ -152,6 +158,8 @@ Item {
settingKey: "fadeToLockGracePeriod"
tags: ["fade", "grace", "period", "timeout", "lock"]
text: I18n.tr("Lock fade grace period")
description: SettingsData.isManaged("fadeToLockGracePeriod") ? root.managedNote : ""
enabled: !SettingsData.isManaged("fadeToLockGracePeriod")
visible: SettingsData.fadeToLockEnabled
options: root.gracePeriodOptions
currentValue: root.gracePeriodText("fadeToLockGracePeriod")
@@ -453,6 +461,8 @@ Item {
tags: ["power", "command", "override", modelData.label]
text: modelData.label
leftIconName: modelData.icon
description: SettingsData.isManaged(modelData.key) ? root.managedNote : ""
enabled: !SettingsData.isManaged(modelData.key)
value: SettingsData[modelData.key] || ""
placeholderText: modelData.placeholder
onValueEdited: value => SettingsData.set(modelData.key, value.trim())