batch change user authentication to LDAP

batch change user authentication to LDAP

by Rocco Lewis -
Number of replies: 3
Hello,
I am trying to batch change all our users to authenticate using LDAP. Initially, I imported the users but now I want all those users to use LDAP. thanks for any help.
Average of ratings: -
In reply to Rocco Lewis

Re: batch change user authentication to LDAP

by Juan David Martínez Pavony -

Hello.

Do you have DB admin access? Which DB product do you use: MySQL, PostgreSQL?

If so, you can run an update query for all records in users table.

Let me know.

In reply to Juan David Martínez Pavony

Re: batch change user authentication to LDAP

by Rocco Lewis -
Hi Juan,
We are using MySQL.
Thanks for helping.
In reply to Rocco Lewis

Re: batch change user authentication to LDAP

by Juan David Martínez Pavony -

Hello again.

You mentioned you had uploaded users before. Can you erase those you want to have LDAP authentication and they exists in your text file?

If YES, then change the text file so you add a new field called 'auth'. Add it between required fields and default fields.

      username, password, firstname, lastname, email, auth, .... idnumber, icq, phone1, ...

Then assign to those users you want LDAP authentication a value of 'ldap' for 'auth' field.

     username, password, firstname, lastname, email, auth, .... idnumber, icq, phone1, ...

   myuser1, itspwd1, One user, to test, anemail@emailsvr.dom, ldap, .... 4, 456213, 5557634599, ...

If NO, then I am afraid you must go under and directly to MySQL syntax. For this case YOU HAVE TO BE EXTREMELY CAREFUL. Query your mdl_user table and identify which ids you have to UPDATE. Maybe a range or a point to start is what you will figure out. (DO YOU HAVE A BACKUP? mixed)

    Then, run something like:

       update mdl_user set auth = 'ldap' where id > pointtostart;

       or

       update mdl_user set auth = 'ldap' where id > lowervalue and id < uppervalue;

where pointtostart is the id number in your DB where your users counting starts, I mean, the lower number assigned to the first user you want to change. BE CAREFUL, because id 1 and id 2 are UNTOUCHABLE (guest and ADMIN users).dead

lowervalue and uppervalue is for a range of ids.

Are there any other kind of user (teachers, tutors)? Identify pretty well whose you really want to set LDAP authentication.

Good luck. Be careful, be careful. wink