#9171 Boolean value not mapped on WebUI checkbox
Closed: fixed 2 years ago by frenaud. Opened 2 years ago 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

Metadata Update from @abbra:
- Issue assigned to abbra

2 years ago

master:

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

ipa-4-9:

  • faeb656 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)

2 years ago

master:

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

ipa-4-9:

  • 23d56bb ipa-replica-install: nsds5replicaUpdateInProgress is a Boolean
  • c6bc8fd 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.

2 years ago

master:

  • 8a415ff check_repl_update: in progress is a boolean

ipa-4-9:

  • 05a298f check_repl_update: in progress is a boolean

ipa-4-10:

  • 2003eb6 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:

  • e5bb0f3 ipatests: fix tasks.wait_for_replication method

ipa-4-11:

  • 7f11425 ipatests: fix tasks.wait_for_replication method

ipa-4-10:

  • 278c2cb ipatests: fix tasks.wait_for_replication method

ipa-4-9:

  • 44a7624 ipatests: fix tasks.wait_for_replication method

Login to comment on this ticket.

Metadata