Today's Daily Drupal is about integrating Drupal with external databases. Obviously this is a huge topic, so a forum like The Daily Drupal is not ideal to cover it in a post. But, as The Daily Drupal is really just my log about working with Drupal (we started our project just over 2 months ago now, so I'm very new to the system), I'll throw out some keywords and thoughts on this topic, as I see it now.
We have a large, external user database that we need to use to authenticate users in our Drupal installation (single codebase, multi-site installation for about 70 sites as here). So, what we need to happen is this: when a user visits any one of our Drupal sites, they can login with the credentials used for current, externally hosted database and their roles, affiliations and other information are "imported" or mapped to Drupal permissions, roles, etc. thus allowing this external database to control what they can and can't do on our sites.
We've been given some advice from consultants, namely:
- implement the hook_form_alter() to alter the way authentication is done
- calls an our external DB returning an XML response with the required info
- create a MySQL database that the external DB managers can insert data into (preferably one dump with subsequent hourly updates transferring changed data only)
- then, run a process that maps this MySQL DB to the user DB of Drupal
All seems reasonable to me, and I'm sure that there are many (not infinite) other paradigms one could use to accomplish this task. I'm also quite aware that the technical details might not be as straightforward as this all sounds depending on the DB and complexity of the roles/permissions scheme. Obviously, whichever method we ultimately use, security will be of highest priority. I have searched drupal.org for this issue but found it slightly tricky. I searched for phrases like "authenticating users from external database" and "external database integration with drupal" but found a lot of unanswered questions and no clear instructions. I'm not surprised as this issue is so case-specific and really depends on which DB you're trying to plug into Drupal.
This functionality is not urgent right now in our project, so I'll continue the search for case studies, example scenarios, etc. and see what I come up with. One thing's for sure, we're definitely NOT the only Drupal newbies facing this issue as many people must have data in existing DBs that wish to use in Drupal.
This has been the Daily Drupal for 21 July 2009. To subscribe to The Daily Drupal, week-daily column about Drupal from the perspective of a new Drupal user, use this feed.
PS. I promised to write about something besides Drupal on this blog, namely: library and information science, Web 2.0 and Web 3.0/Semantic Web as well as occasional posts about music. This is still the case. I'm just drowning in Drupal at the moment!