mdm: return values rather than the constant names for the setting enums

We stringify setting values with toString before returning them from the syspolicyHandler.
For enum setting types, such as AlwaysNeverUserDecides and ShowHide, the default toString
implementation returns the enum constant names, such as Always and UserDecides. However,
the Go backend requires us to return "always", "never", and "user-decides" values, exactly, and
falls back to the default value (e.g., "user-decides") if it receives anything else from the app.

This PR overrides the toString methods on both enums to return the required values rather than
the constant names.

Updates tailscale/tailscale#12687

Signed-off-by: Nick Khyl <nickk@tailscale.com>
pull/461/head
Nick Khyl 3 months ago committed by Nick Khyl
parent ea0c1e960d
commit 101c9dd121

@ -85,9 +85,17 @@ enum class AlwaysNeverUserDecides(val value: String) {
get() {
return this != UserDecides
}
override fun toString(): String {
return value
}
}
enum class ShowHide(val value: String) {
Show("show"),
Hide("hide")
Hide("hide");
override fun toString(): String {
return value
}
}

Loading…
Cancel
Save