Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] users_ldap_populate: Migration to 17.0 #675

Merged
merged 49 commits into from
Feb 12, 2025

Conversation

ryanc-me
Copy link

No description provided.

@cvinh
Copy link

cvinh commented Nov 22, 2024

Hello @ryanc-me are you going to work on that PR ?
@vehi-invitu

@ryanc-me
Copy link
Author

@cvinh yes, the migration is done - the PR is blocked due to a bug (?) with codecov. we're running this module in production v17 :)

@cvinh
Copy link

cvinh commented Nov 26, 2024

I have this error with this PR

users_ldap_populate/models/users_ldap.py", line 68, in action_populate
    login = result[1][login_attr][0].lower().strip()
            ~~~~~~~~~^^^^^^^^^^^^
TypeError: list indices must be integers or slices, not str

@cvinh
Copy link

cvinh commented Nov 27, 2024

I have this error with this PR

users_ldap_populate/models/users_ldap.py", line 68, in action_populate
    login = result[1][login_attr][0].lower().strip()
            ~~~~~~~~~^^^^^^^^^^^^
TypeError: list indices must be integers or slices, not str

ok, it's a problem with my LDAP Base, I took the root and I had all the ldap records including the AD stuff
(None, ['ldap://test.loc/CN=Configuration,DC=test,DC=loc']),
(None, ['ldap://test.loc/DC=DomainDnsZones,DC=test,DC=loc']),
(None, ['ldap://test.loc/DC=ForestDnsZones,DC=test,DC=loc'])]

Maybe this can be improved in another commit

I can review this PR if you put it in Ready for Review state

gurneyalex and others added 16 commits November 27, 2024 14:31
Currently translated at 100.0% (21 of 21 strings)

Translation: server-tools-10.0/server-tools-10.0-users_ldap_populate
Translate-URL: https://translation.odoo-community.org/projects/server-tools-10-0/server-tools-10-0-users_ldap_populate/fr/
* [10.0] users_ldap_populate special characters
Without this fix, when hitting the populate button, Odoo failed with:

```
 Odoo Server Error

Traceback (most recent call last):
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 656, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 314, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/opt/odoo/custom/src/odoo/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 698, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 346, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/custom/src/odoo/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 339, in checked_call
    result = self.endpoint(*a, **kw)
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 941, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 519, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/auto/addons/web/controllers/main.py", line 966, in call_button
    action = self._call_kw(model, method, args, {})
  File "/opt/odoo/auto/addons/web/controllers/main.py", line 954, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/custom/src/odoo/odoo/api.py", line 759, in call_kw
    return _call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/custom/src/odoo/odoo/api.py", line 746, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/auto/addons/users_ldap_populate/models/users_ldap.py", line 189, in populate_wizard
    res_id = wizard_obj.create({'ldap_id': self.id}).id
  File "<decorator-gen-155>", line 2, in create
  File "/opt/odoo/custom/src/odoo/odoo/api.py", line 461, in _model_create_multi
    return create(self, [arg])
  File "/opt/odoo/auto/addons/users_ldap_populate/models/populate_wizard.py", line 32, in create
    ldap.action_populate()
  File "/opt/odoo/auto/addons/users_ldap_populate/models/users_ldap.py", line 65, in action_populate
    results = self._get_ldap_entry_dicts(conf)
  File "/opt/odoo/auto/addons/users_ldap_populate/models/users_ldap.py", line 128, in _get_ldap_entry_dicts
    ldap_password.encode('utf-8')
  File "/usr/local/lib/python3.7/site-packages/ldap/ldapobject.py", line 382, in simple_bind_s
    msgid = self.simple_bind(who,cred,serverctrls,clientctrls)
  File "/usr/local/lib/python3.7/site-packages/ldap/ldapobject.py", line 376, in simple_bind
    return self._ldap_call(self._l.simple_bind,who,cred,RequestControlTuples(serverctrls),RequestControlTuples(clientctrls))
  File "/usr/local/lib/python3.7/site-packages/ldap/ldapobject.py", line 263, in _ldap_call
    result = func(*args,**kwargs)
TypeError: argument 1 must be str, not bytes
```
Don't know why the POT hasn't been regenerated.
Currently translated at 100.0% (22 of 22 strings)

Translation: server-auth-16.0/server-auth-16.0-users_ldap_populate
Translate-URL: https://translation.odoo-community.org/projects/server-auth-16-0/server-auth-16-0-users_ldap_populate/it/
Currently translated at 100.0% (22 of 22 strings)

Translation: server-auth-16.0/server-auth-16.0-users_ldap_populate
Translate-URL: https://translation.odoo-community.org/projects/server-auth-16-0/server-auth-16-0-users_ldap_populate/pt_BR/
@ryanc-me ryanc-me force-pushed the 17.0-mig-users_ldap_populate branch from eef2d08 to 023ac25 Compare November 27, 2024 01:31
@ryanc-me ryanc-me marked this pull request as ready for review November 27, 2024 01:37
@ryanc-me
Copy link
Author

ryanc-me commented Dec 1, 2024

@cvinh Sorry, not sure if you got a notification about the rebase. It's all ready for review now!

Copy link

@cvinh cvinh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested in real situation with 100 users

@pedrobaeza
Copy link
Member

/ocabot migration users_ldap_populate

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Feb 12, 2025
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 17.0-ocabot-merge-pr-675-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 617a4d2 into OCA:17.0 Feb 12, 2025
4 of 7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 9c5c3ba. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.