#9171 Boolean value not mapped on WebUI checkbox
Closed: fixed by frenaud. Opened by leonidas-o.

Request for enhancement

As user , I want that a stored boolean value is mapped correctly on WebUI's checkbox.

Issue

As working on an postfix book plugin for FreeIPA, I introduced a new boolen attributeType called mailEnabled which is of type checkbox for the WebUI. When saving a user with checked mailEnabled, it disappears.
When the users details view is re-entered, it still is unchecked although "ipa user-show" lists it as "Mail Enabled: TRUE"

Steps to Reproduce

Don't know if it is happening on other checkboxes, too:
Comment from Alexander:
"TRUE/FALSE in LDAP is correct (that's how boolean type is expected to behave). What is probably happening is that in IPA framework we don't properly convert to Python bool type and just return a string (TRUE or FALSE). This is worth a bug to be opened -- I can see this with other boolean attributes, like

Bool('idnsallowdynupdate?', 
   cli_name='dynamic_update', 
   label=_('Dynamic update'), 
   doc=_('Allow dynamic updates.'), 
   attribute=True, 
   default=False, 
   autofill=True ),  

in 'ipa dnszone-show'
"

My plugin can be found here: https://github.com/leonidas-o/freeipa-postfixbook-plugin

  1. Install the plugin
  2. Create a new user and check "Mail enabled" under "misc" section
  3. save and refresh page

Actual behavior

WebUI's Checkbox not matching stored boolean values TRUE/FALSE.

Expected behavior

WebUI's checkbox should either be checked or unchecked according to the boolean value TRUE or FALSE.

Version/Release/Distribution

$ rpm -q freeipa-server freeipa-client ipa-server ipa-client 389-ds-base pki-ca krb5-server

package freeipa-server is not installed
package freeipa-client is not installed
ipa-server-4.9.8-7.module+el8.6.0+796+128eec25.x86_64
ipa-client-4.9.8-7.module+el8.6.0+796+128eec25.x86_64
389-ds-base-1.4.3.28-6.module+el8.6.0+782+23a9774d.x86_64
pki-ca-10.12.0-2.module+el8.6.0+788+76246f77.noarch
krb5-server-1.18.2-14.el8.x86_64

PR: https://github.com/freeipa/freeipa/pull/6294

Metadata Update from @abbra:
- Issue assigned to abbra

master:

  • 6c5f2bcb301187f9844985ffe309c7d2262e16f3 ipaldap: fix conversion from boolean OID to Python

ipa-4-9:

  • faeb656c77adf27a49ccaceb57fc1ba44e11cc1d ipaldap: fix conversion from boolean OID to Python

Metadata Update from @frenaud:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

master:

  • 8a4ad659362f0d2bc843ba32a059cdc6bfcecc24 ipa-replica-install: nsds5replicaUpdateInProgress is a Boolean
  • 8f785482df01ea2dd8574ea36cfd762c816d8367 ipatests: update expected output for boolean attribute

ipa-4-9:

  • 23d56bb95229756054df72de4d50fead8fc6116e ipa-replica-install: nsds5replicaUpdateInProgress is a Boolean
  • c6bc8fd4c80d7ab9cd369ffce521d52c0eabe4cb ipatests: update expected output for boolean attribute

Metadata Update from @abbra:
- Custom field changelog adjusted to FreeIPA now properly exposes boolean LDAP values at IPA API Python and JSON-RPC levels. External IPA API consumers might need to switch from using "TRUE" and "FALSE" strings to True and False boolean values.

master:

  • 8a415ff985b93dc1b9beccaa2e1b6793e2a6d854 check_repl_update: in progress is a boolean

ipa-4-9:

  • 05a298f56485222583cb7dd4f6a3a4c5c77fc8cf check_repl_update: in progress is a boolean

ipa-4-10:

  • 2003eb6b3d4a27a5de5eaa79418f115dd99886cd check_repl_update: in progress is a boolean

@abbra or someone else, I tested freeipa/freeipa-server:rocky-9-4.10.1 and the boolean value is still not displayed correctly inside the UI. An ldap query shows the bool value is set to true but the checkbox in the UI is not checked.
What happened to that fix? Can someone please clarify if that fix is/is not in the current freeipa/freeipa-server:rocky-9-4.10.1(Digest: 878e8d7fa4fe, Date: Oct 13, 2023 at 7:26 am)?

@leonidas-o all the patches listed in this issue are present on the release 4.10.1. Do you see the issue only for your custom attribute or for others, too?

@frenaud I see it on my own "mail enabled" checkbox only, other default checkboxes work BUT the checkbox handling behind the scenes was kind of a work around according to @abbra : https://lists.fedoraproject.org/archives/list/freeipa-users@lists.fedorahosted.org/message/YCSU3LGRWU6SEZSLZY7CSRNS4QRKM7R3/

So your checkboxes always worked because of this work around he mentioned. My plugin for example is here: https://github.com/leonidas-o/freeipa-postfixbook-plugin/blob/main/plugin/ui/mailenabled.js

And Alexander mentioned in: https://lists.fedoraproject.org/archives/list/freeipa-users@lists.fedorahosted.org/message/6BWLIYOXPCVSRU7Q2GJZ2PGQQU44LAAK/

"Without fixes from https://github.com/freeipa/freeipa/pull/6294, you'd need to use an approach taken by idnsallowdynupdate:"
And I'm clearly not using $type: 'radio', so for me it seems the fix is not in this docker image OR I'm still missing something in my module.

master:

  • e5bb0f392a5f0a6e49c92b2da953b12c5cd66ffc ipatests: fix tasks.wait_for_replication method

ipa-4-11:

  • 7f1142504d41a821357168acd2484c7cb7c1a4c2 ipatests: fix tasks.wait_for_replication method

ipa-4-10:

  • 278c2cbb193496302f8c0abc4ce502ec83f47a12 ipatests: fix tasks.wait_for_replication method

ipa-4-9:

  • 44a762413c83f9637399afeb61b1e4b1ac111260 ipatests: fix tasks.wait_for_replication method
Metadata