Hello all,
I've been using CAS on my site for a little while now successfully. I have the "Automatically create Drupal accounts" setting checked which is working good.
Now I'm trying to import some users using the User Import module which also works good.
THE PROBLEM
If I'm importing users who will also be using the CAS login, when they try to login they get this error message..."A new account could not be created for . The username is already in use on this site."
It seems like CAS is trying to create the username when it already exists. Is it possible to put a check in so that if the username already exists and has the proper @domain.com email address for a CAS login it will let the person login via CAS?
I'm basically trying to import a bunch of CAS users and assign them a role using the User Import module. Which again works fine, it's just that now CAS won't let them login using the CAS login even though they have the correct @domain.com email address.
Thanks for reading,
-Tim
Comments
Comment #1
TimG1 commentedHello again,
So it seems that the import module doesn't add the "cas username" to the user account. So, I need to figure out how to do that. I'm guessing that this is the problem and if I can figure this out then this won't be an issue.
-Tim
Comment #2
TimG1 commentedHi again,
I thought maybe I could get around this by adding a Views Bulk Operation to copy the username field to the cas username field using a token after my initial import. But it doesn't seem that Views Bulk Operations has access to modify the cas username field.
-Tim
Comment #3
TimG1 commentedMe again,
Well I think I have a work around figured out.
The above seems to be working okay so far. Does anyone know if there is anything else I should be updating/doing in my PHP in step 3?
Leaving this open and changing the title.
Many thanks,
-Tim
Comment #4
bfroehle commentedHi TimG1:
It sounds like you figured it out!
As you discovered, the key is the
{cas_user}table which maps CAS usernames to Drupal user IDs.Another good way to populate the
{cas_user}table is with a bulk SQL command. For example (as taken from the comments incas.install):Comment #5
bkosborneSounds like the real feature request here is the ability to automatically associate existing users with CAS users. Seems like sort of an edge case that can be solved by just running a query like above. Otherwise, I think it would be best to have someone who wants that to open a new feature request for it.
Comment #6
kcolwell commentedHappy to see these examples of how to get this to work if you already have users.
I'm in the process of switching from just using ldap logins to using CAS and it would have been really cool if this had been some kind of option on install or a configuration option.
Thanks,
Ken Colwell