Hello,

Right now, I am writing a sub module for Drupal LDAP called ldap_register. Which will give user an option to go through the registration process and create an account in Drupal only if that particular record is present in AD.

I am stuck in a place where I would need to get DN attribute from a specific user by using the email ID. email ID will be stored in a variable in the process of registration.
Can some one please share the code to get the DN attribute for an user when I know the email ID.

--
Thanks
Prashanth

Comments

plingamn created an issue. See original summary.

queenvictoria’s picture

Hey isn't this built in? This is the way LDAP User works. Local accounts are created from LDAP properties. There are field mappers from LDAP properties to User fields. What does LDAP register do differently?

plingamn’s picture

Hello queenvictoria,

Right now login and creating account both are happening from the login form. For me Registration and User login should be different. That is the reason I am writing a new module which will separate both the login and the registration.

--
Thanks
Prashanth

grahl’s picture

Category: Task » Support request
Priority: Normal » Minor
Status: Active » Closed (works as designed)

Hi

What you are doing sounds a bit weird, there are likely better approaches to what you are trying to do than reimplement the registration form and process. Maybe you did not provide enough information but just in terms of your description that you are trying to register users which already exist in LDAP, this seems to take the wrong way round.

If you really want to do what you are describing and I understand you correctly, you'd likely have to do the following:
- Search LDAP with the filter matching the email field
- Parse the response to receive the matching DN (helper functions exist)
- Check whether a user exists with that puid and register otherwise, the ServerFactory and Server class should contain enough hints, if you follow them from the hooks in ldap_user.module.

I don't think this request is adequate for the module issue queue since it concerns your custom development. You might want to consider paid support.

plingamn’s picture

Hello grahl,

Thanks a lot for describing how can i achieve the functionality. I looked into the ServerFactory and Server class, I have got lot of clue. I am working on them.
Will reach out to you if i m really stuck some where.

Once again I appreciate all your help ..

--
Best
Prashanth