What we want to do is a bit complicated, and I'm trying to understand cas hooks (I think).
We have the cas modules installed and a cas server authemitcating against an openLDAP DB installed elsewhere. I can get drupal to authenticate fine via the cas module, returning the message "hello cas_username". But the cas_username is the email address, because that is all LDAP is returning. We do not want the username to be equal to the email address. The username which we want to show resides on yet another DB. Did I mention this was complicated?
So what I want to do is
1. have cas return the authenticated email (this works)
2. run a query against the other DB which returns the username (i have a module which does this query)
3. Have cas (or whichever module is doing it) insert/update the drupal user table with the returned username and email
How do I join these all up without hacking anything? Its a hook somewhere I presume, but I can't quite figure it out.
Thanks.
Comments
Comment #1
Anonymous (not verified) commentedI think this is how it works ...
function muModuleName_auth_transform($op, &$cas_name) {
switch($op) {
case "cas":
//... do what you want here
drupal_set_message("cas_name: $cas_name");
break;
}
}
Comment #2
Anonymous (not verified) commentedClosed too soon.
I can transform the name using the above code, but how do I pass that transformed cas_name back into the cas module such that it inserts the new transformed name into the database?
Again, cas is returning an email address as a username and we want a username that comes fermo another db based on that email address.
Comment #3
metzlerd commentedBascially you just alter the parameter varialble. Be sure to define it as passed by reference in your function declaration (including the &).
Dave
Comment #4
Anonymous (not verified) commentedthanks - done