freeipa/ipapython
Alexander Bokovoy 6c5f2bcb30 ipaldap: fix conversion from boolean OID to Python
In IPA framework we don't properly convert to Python bool type and just
return a string (TRUE or FALSE). This can be seen with many 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':

> > > api.Command.dnszone_show('ipa.test')['result']['idnsallowdynupdate']
['TRUE']

This is because we don't have the reverse (from LDAP to Python) mapping
for the LDAP boolean OID 1.3.6.1.4.1.1466.115.121.1.7.

When Web UI asks for the entry, it gets back JSON output that contains
this 'TRUE' value:

            "idnsallowdynupdate": [
                "TRUE"
            ],

Add proper mapping from LDAP to Python bool type. With this, a simple
'checkbox' type can be used in Web UI instead of a complex radio-box
setup.

Note that when IPA API is asked to return raw values, 'TRUE' and 'FALSE'
still returned. These are the actual LDAP boolean attribute values. Care
needs to be done in tests:

 - if output is from a command with --raw option, 'TRUE' or 'FALSE'
   should be expected

 - if output if from a normal (non-raw) command, True or False would be
   returned

Fixes: https://pagure.io/freeipa/issue/9171

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
2022-06-10 09:25:27 +02:00
..
install pylint: Fix arguments-renamed 2022-03-11 13:37:08 -05:00
__init__.py Rename ipa-python directory to ipapython so it is a real python library 2009-02-09 14:35:15 -05:00
admintool.py pylint: Fix useless-suppression 2022-03-11 13:37:08 -05:00
certdb.py pylint: Fix consider-using-in 2022-03-11 13:37:08 -05:00
config.py Unify access to FQDN 2020-10-26 17:11:19 +11:00
cookie.py pylint: Skip unused-private-member for unsupported cases 2022-03-11 13:37:08 -05:00
directivesetter.py Grammar: whitespace is a word 2020-06-23 10:16:29 +02:00
dn_ctypes.py Load libldap_r-*.so.2 2019-05-14 12:27:55 +02:00
dn.py Removes several pylint warnings. 2019-09-27 09:38:32 +02:00
dnsutil.py pylint: Fix useless-suppression 2022-03-11 13:37:08 -05:00
dogtag.py pylint: Fix useless-suppression 2022-03-11 13:37:08 -05:00
errors.py Replace StandardError with Exception 2015-09-30 10:51:36 +02:00
fqdn.py Easier to use ipa_gethostfqdn() 2020-10-26 17:11:19 +11:00
graph.py Py3: Remove subclassing from object 2018-09-27 11:49:04 +02:00
ipa_log_manager.py Remove deprecated object logger 2019-04-23 12:55:35 +02:00
ipachangeconf.py pylint: Fix useless-suppression 2022-03-11 13:37:08 -05:00
ipaldap.py ipaldap: fix conversion from boolean OID to Python 2022-06-10 09:25:27 +02:00
ipautil.py dnssec daemons: read the dns context config file for debug state 2022-06-02 11:17:57 +02:00
ipavalidate.py Change FreeIPA license to GPLv3+ 2010-12-20 17:19:53 -05:00
kerberos.py Py3: Replace six.bytes_type with bytes 2018-09-27 16:11:18 +02:00
kernel_keyring.py Don't configure KEYRING ccache in containers 2019-01-18 11:33:11 +01:00
Makefile.am ipapython: fix DEFAULT_PLUGINS in version.py 2017-03-09 18:39:48 +01:00
nsslib.py Remove ipapython.nsslib as it is not used anymore 2017-03-01 09:43:41 +00:00
README Replace DNS client based on acutil with python-dns 2012-05-24 13:55:56 +02:00
session_storage.py Fix pylint warnings inconsistent-return-statements 2017-12-18 11:51:14 +01:00
setup.cfg Port all setup.py to setuptools 2016-10-20 18:43:37 +02:00
setup.py Add helpers for resolve1 and nameservers 2020-09-23 16:44:26 +02:00
ssh.py pylint: Fix useless-suppression 2022-03-11 13:37:08 -05:00
version.py.in Manually reformat ipapython/version.py.in 2020-05-05 10:42:46 +02:00

This is a set of libraries common to IPA clients and servers though mostly
geared currently towards command-line tools.

A brief overview:

config.py - identify the IPA server domain and realm. It uses python-dns to
            try to detect this information first and will fall back to
            /etc/ipa/default.conf if that fails.

ipautil.py - helper functions

entity.py - entity is the main data type. User and Group extend this class
            (but don't add anything currently).

ipavalidate.py - basic data validation routines