Skip to content
Snippets Groups Projects
Commit 9aef423d authored by Martin Trigaux's avatar Martin Trigaux Committed by Christophe Monniez
Browse files

[FIX] auth_ldap: replace the deprecated library by one up to date

At 795c7b0a the external dependencies was changed from trying
to import 'ldap' to checking than 'pyldap' package was installed.
The problem is that pyldap is a unmaintained library that should no
longer be used, as explained on the package page:
https://pypi.org/project/pyldap/


"The pyldap fork was merged back into python-ldap, and released as
 python-ldap 3.0.0."

Having pyldap version >= 3.0 installs python-ldap automatically and
will not cause any issue.

The Debian control file package name is adapted to use the latest.

The "ldap" externalm dependency defined in __manifest__.py will cause
pkg_resources.get_distribution() to fail in both case ("python-lap" or
"pyldap"), but the "import" fallback will succeed. For that reason, the
log warning is turned into a log info.

closes odoo/odoo#43769

Note: This library should be replaced by the pure python "ldap3" library.
X-original-commit: 1afd0ccf
Signed-off-by: default avatarChristophe Monniez (moc) <moc@odoo.com>
parent b980086d
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ Adds support for authentication by LDAP server. ...@@ -3,7 +3,7 @@ Adds support for authentication by LDAP server.
This module allows users to login with their LDAP username and password, and This module allows users to login with their LDAP username and password, and
will automatically create Odoo users for them on the fly. will automatically create Odoo users for them on the fly.
**Note:** This module only work on servers who have Python's ``ldap`` module installed. **Note:** This module only work on servers that have Python's ``python-ldap`` module installed.
Configuration: Configuration:
-------------- --------------
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
'views/res_config_settings_views.xml', 'views/res_config_settings_views.xml',
], ],
'external_dependencies': { 'external_dependencies': {
'python': ['pyldap'], 'python': ['ldap'],
} }
} }
...@@ -68,7 +68,7 @@ PKGS_TO_INSTALL=" ...@@ -68,7 +68,7 @@ PKGS_TO_INSTALL="
python3-feedparser \ python3-feedparser \
python3-pil \ python3-pil \
python3-jinja2 \ python3-jinja2 \
python3-ldap3 \ python3-ldap \
python3-lxml \ python3-lxml \
python3-mako \ python3-mako \
python3-mock \ python3-mock \
......
...@@ -51,7 +51,7 @@ Replaces: tinyerp-server, openerp-server, openerp-web, openerp ...@@ -51,7 +51,7 @@ Replaces: tinyerp-server, openerp-server, openerp-web, openerp
Recommends: Recommends:
${python3:Recommends}, ${python3:Recommends},
postgresql, postgresql,
python3-pyldap, python3-ldap,
Description: Open Source Apps To Grow Your Business Description: Open Source Apps To Grow Your Business
Odoo, formerly known as OpenERP, is a suite of open-source business apps Odoo, formerly known as OpenERP, is a suite of open-source business apps
written in Python and released under the LGPLv3 license. This suite of written in Python and released under the LGPLv3 license. This suite of
......
...@@ -320,7 +320,7 @@ class Module(models.Model): ...@@ -320,7 +320,7 @@ class Module(models.Model):
except pkg_resources.DistributionNotFound as e: except pkg_resources.DistributionNotFound as e:
try: try:
importlib.import_module(pydep) importlib.import_module(pydep)
_logger.warning("python external dependency %s should be replaced by it's PyPI package name", pydep) _logger.info("python external dependency on '%s' does not appear to be a valid PyPI package. Using a PyPI package name is recommended.", pydep)
except ImportError: except ImportError:
# backward compatibility attempt failed # backward compatibility attempt failed
_logger.warning("DistributionNotFound: %s", e) _logger.warning("DistributionNotFound: %s", e)
......
...@@ -28,7 +28,7 @@ psutil==5.5.1 ...@@ -28,7 +28,7 @@ psutil==5.5.1
psycopg2==2.7.7; sys_platform != 'win32' psycopg2==2.7.7; sys_platform != 'win32'
psycopg2==2.8.3; sys_platform == 'win32' psycopg2==2.8.3; sys_platform == 'win32'
pydot==1.4.1 pydot==1.4.1
pyldap==2.4.28; sys_platform != 'win32' python-ldap==3.1.0; sys_platform != 'win32'
pyparsing==2.2.0 pyparsing==2.2.0
PyPDF2==1.26.0 PyPDF2==1.26.0
pyserial==3.4 pyserial==3.4
......
...@@ -33,7 +33,6 @@ requires = ...@@ -33,7 +33,6 @@ requires =
python3-psycopg2 python3-psycopg2
python3-polib python3-polib
python3-pydot python3-pydot
python3-pyldap
python3-pyparsing python3-pyparsing
python3-PyPDF2 python3-PyPDF2
python3-pyserial python3-pyserial
......
...@@ -59,7 +59,7 @@ setup( ...@@ -59,7 +59,7 @@ setup(
], ],
python_requires='>=3.6', python_requires='>=3.6',
extras_require={ extras_require={
'ldap': ['pyldap'], 'ldap': ['python-ldap'],
'SSL': ['pyopenssl'], 'SSL': ['pyopenssl'],
}, },
tests_require=[ tests_require=[
......
...@@ -19,7 +19,6 @@ polib>=1.1.0 ...@@ -19,7 +19,6 @@ polib>=1.1.0
psutil>=4.3.1 psutil>=4.3.1
psycopg2==2.7.1 psycopg2==2.7.1
pydot==1.2.3 pydot==1.2.3
pyldap>=2.4.28
pyparsing==2.1.10 pyparsing==2.1.10
PyPDF2==1.26.0 PyPDF2==1.26.0
pyserial==3.1.1 pyserial==3.1.1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment