Opened 11 years ago
Last modified 5 years ago
#11411 new enhancement
Add LDAP E-mail Resolving
Reported by: | Rolando Nieves | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | AnnouncerPlugin |
Severity: | normal | Keywords: | ldap |
Cc: | Trac Release: | 1.0 |
Description
At our Trac site we have an OpenLDAP directory that serves as the central authentication point for workstations, SVN, and Trac. In it we have put all of our pertinent information, including a valid e-mail address.
After getting the AnnouncerPlugin working I wondered if I could extend it to include a "resolver" (as it is called in the plugin's parlance) that would look up user's e-mail address in the LDAP directory. I believe I was able to get at least a good start down that path. Attached to this ticket I have included a diff patch for the announcer/resolvers.py
file which creates a new e-mail resolver: LdapEmailResolver
.
The resolver carries with it several configuration options. All of the details of how to use these options is in the announcer/resolvers.py
file.
I realize that all of this work will be overcome by events once IUserProvider
is rolled out and the appropriate components are written against it. But, for now, this fit the bill just fine for me. I'm submitting it in the hope that it is useful to others.
Attachments (2)
Change History (13)
Changed 11 years ago by
Attachment: | announcerplugin_ldappatch.diff added |
---|
comment:1 Changed 11 years ago by
Cc: | Ryan J Ollos added; anonymous removed |
---|
Thank you for your valuable contribution.
I'd appreciate at least on independent test of the patch, because I've no suitable environment. By chance: Is it possible (for you) to contribute some unit tests for the new component and its methods too? I ask this in recognition of my nearly total absence of experience with LDAP.
comment:2 Changed 11 years ago by
I'd like to add to this ticket that I have used this patch and it worked once i figured out the necessary configuration variables. Good work and thank you! Please apply this patch to the Announcer plugin as i can confirm it works. (and please add a tiny example config for ldap section)
comment:3 Changed 11 years ago by
#11559, that recommends a rename of configuration options, has been closed as a duplicate of this ticket.
comment:4 Changed 10 years ago by
#11936 has been closed as a duplicate for asking about the enhancement suggested here.
comment:5 follow-up: 7 Changed 10 years ago by
This is not working for me on trac 1.01. for trac 0.12 i created a plugin. any suggestions to get this working for trac 1.01?
After i have pacthed. I have played around with email_address_resolvers
, just keeping LdapEmailResolver
or addign others makes no difference to LdapEmailResolver
. Also it CC's the notification section and not announcer section.
[announcer] email_address_resolvers = SessionEmailResolver, LdapEmailResolver email_enabled = true email_from = trac@domain.com email_from_name = Paradox email_replyto = noreply@domain.com email_sender = SmtpEmailSender email_subject_prefix = __default__ ldap_bind_dn = cn=ldaplookup,cn=Users,dc=domain,dc=com ldap_bind_pw = *** ldap_email_attr_name = mail ldap_search_base = ou=Sites,dc=domain,dc=com ldap_search_filter = userPrincipalName ldap_start_tls = false ldap_uri = ldap://ldapauth.domain.com smtp_always_cc = Ramy.Mahmoud@domain.com, support@domain.com smtp_default_domain = domain.com smtp_password = smtp_port = 25 smtp_replyto = no-reply@domain.com smtp_server = hero.uk.domain.com smtp_subject_prefix = __default__ smtp_user = use_public_cc = true use_short_addr = false use_tls = false [notification] email_address_resolvers = SessionEmailResolver, LdapEmailResolver email_enabled = true email_sender = SmtpEmailSender smtp_enabled = true smtp_from = trac@domain.com smtp_from_author = Paradox smtp_from_name = Paradox smtp_password = smtp_port = 25 smtp_replyto = no-reply@domain.com smtp_server = hero.uk.domain.com smtp_subject_prefix = __default__ smtp_user = use_public_cc = true smtp_always_cc = Ramy.Mahmoud@domain.com, support@domain.com
I hacked notification.py to make it work. attached is diff.
comment:6 Changed 10 years ago by
Please use the unified diff format for patches, as described in trac:TracDev/SubmittingPatches.
comment:7 Changed 10 years ago by
Replying to shorif2000:
This is not working for me on trac 1.01. for trac 0.12 i created a plugin. any suggestions to get this working for trac 1.01?
Wait a moment. You're a bit too fast for me. You claim (plugin) "not working with Trac 1.0.1", but in next sentence you switch to Trac 0.12 and show a Python2.4 issue to us in SO question(s).
Your configuration is a bit fuzzy too. You should disregard any setting in [notification] while using announcer.
comment:8 Changed 10 years ago by
I used your patch for trac 1.01. However I could not get it to work. Can you give some instructions?
comment:9 Changed 10 years ago by
Thank you for the patch, it works great. I had to change ldap.SCOPE_ONELEVEL by ldap.SCOPE_SUBTREE in directory.search_s function with my LDAP though. It may be a good idea to make it configurable ?
comment:10 Changed 8 years ago by
Owner: | Steffen Hoffmann deleted |
---|
comment:11 Changed 5 years ago by
Cc: | Ryan J Ollos removed |
---|
LDAP e-mail resolver patch