-
Notifications
You must be signed in to change notification settings - Fork 25
Fix ldap.MOD_ADD, ldap.MOD_DELETE and ldap.MOD_REPLACE operations on multi-value attribute descriptions #21
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
Conversation
|
Can you include tests?
…-Tim Abbott (mobile)
On Fri, Nov 27, 2020, 12:37 Mike Gabriel ***@***.***> wrote:
------------------------------
You can view, comment on, or merge this pull request online at:
#21
Commit Summary
- fakeldap.py: Fix ldap.MOD_ADD operations for multi-value lists.
- fakeldap.py: Fix ldap.MOD_DELETE operations for multi-value lists
(esp. when only deleting individual values from an multi-value attribute
description.
File Changes
- *M* fakeldap.py
<https://github.com/zulip/fakeldap/pull/21/files#diff-1794df221415c07d72ffbd4e80385d34d326a7c812847d5920c9343023007d74>
(35)
Patch Links:
- https://github.com/zulip/fakeldap/pull/21.patch
- https://github.com/zulip/fakeldap/pull/21.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#21>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAU6NWSRTLT4Y6MTA2PTIYTSSAEYVANCNFSM4UFJGUNA>
.
|
…p. when only deleting individual values from an multi-value attribute description.
…e always stored as tuples in the internal fake LDAP directory.
87a15d1 to
96b2f3f
Compare
|
@timabbott unit tests have now been added. I also had to pull in the patch from #20 into this PR to make tests work. |
The MockLDAP class's internal recording system of LDAP changes and the system for customizing Python LDAP API replies are implemented via storing and returning data into/from Python dictionary-like entities. For putting elements into these entities (namely, MockLDAP.directory, MockLDAP.calls and MockLDAP.return_value_map), all presented data elements (modlists, dn strings, Python LDAP data structures, etc.) need to be hashable. However, Python lists and dictionaries are not hashable. Thus, we now send every incoming data item into a generically designed _tupelize() function. By using the new _tupelize() function, we are now able to drop various individual tuple() calls on list objects inside the processed data elements (thus, we don't need to unwrap these data elements anymore). The _tupelize() function works for all basic Python variable types (booleans, strings, numbers, tuples, lists and dictionaries).
12e6441 to
1e87c4e
Compare
| if op is 0: | ||
| # FIXME: Can't handle multiple entries with the same name | ||
| # its broken right now | ||
| # do a MOD_ADD, assume it to be a list of values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick - Can we leave the piece of the comment saying this is MOD_ADD?
| # do a MOD_ADD, assume it to be a list of values | |
| # do a MOD_ADD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These all look like valuable improvements and the implementation looks correct for fakeldap (we're not intending to be covering all the edge cases and accurately mimicking real LDAP behavior for them - and this expands the range of well-handled scenarios), so I think it should be good to merge @timabbott
|
On Sa 17 Jul 2021 16:36:03 CEST, Mateusz Mandera wrote:
@mateuszmandera approved this pull request.
These all look like valuable improvements and the implementation
looks correct for `fakeldap` (we're not intending to be covering all
the edge cases and accurately mimicking real LDAP behavior for them
- and this expands the range of well-handled scenarios), so I think
it should be good to merge @timabbott
I am ok with all suggested improvements. However, I can't do the PR
update, as I am going on holiday tomorrow early morning.
Please add the suggested comment changes as a commit on top of adjust
my PR branch (you should be able to force-push to it).
Thanks+Greets,
Mike
--
DAS-NETZWERKTEAM
c\o Technik- und Ökologiezentrum Eckernförde
Mike Gabriel, Marienthaler Str. 17, 24340 Eckernförde
mobile: +49 (1520) 1976 148
landline: +49 (4351) 850 8940
GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22 0782 9AF4 6B30 2577 1B31
mail: ***@***.***, http://das-netzwerkteam.de
|
|
@mateuszmandera feel free to make that tweak and merge (I just made sure you have access; should be easy with our |
|
Merged, thanks a lot @sunweaver ! |
No description provided.