[LON-CAPA-admin] Need a way to change all student IDs in our database

Jeffrey Wilson jwilson at sc.edu
Tue Jul 16 17:50:57 EDT 2013

Hi Stuart,

Your instructions worked as advertised.   I was able to extract a list 
of usernames and their associated student IDs.

When I sort the list by username I notice that some usernames have more 
than one ID associated with them.  I suspect that the database contains 
a history of IDs entered for each username.

For example, a sample student I created a while ago has the following 
entries in the ids.db:

111234567 = wilsonteststudent
001234567 = wilsonteststudent

After I create a file with new ID information and upload that using the 
LonCapa add/modify user web interface I now find in the ids.db:

111234567 = wilsonteststudent
001234567 = wilsonteststudent
1000111667 = wilsonteststudent

The third entry is the one now visible to LonCapa.

I need to replace, or remove, the old entries that are in the database.  
I suspect that this might be doable with SQL queries using the update 
function to replace the offending IDs with new ones rather than using 
the LonCapa interface, which seems to create a new database entry.

What would you suggest we look at next?


On 7/10/13 4:08 PM, Stuart Raeburn wrote:
> Hi,
> A user with a Domain Coordinator role can log-in to LON-CAPA, select 
> the DC role and then use:
> Main Menu -> Create users or modify the roles and privileges of users 
> -> Upload a File of Users
> to upload a CSV file containing records of the form:
> username,studentID
> for any number of students.
> On the next page identify which column contains usernames, and which 
> column student IDs.
> A default authentication type needs to be selected (although it will 
> not be used).  For the remaining settings:
> Change authentication for existing users in domain "sc" to these 
> settings?  No (checked)
> Default domain: University of South Carolina (sc)
> Pick the action to take on roles for these users:
> No role changes  (checked)
> Checkboxes for the folloing two items:
> Disable Student/Employee ID Safeguard and force change of conflicting IDs
> (only do if you know what you are doing.)
> Update student/employee ID in courses in which user is active/future 
> student,
> (if forcing change).
> should both be checked.
> Click the "Update Users" button
> If there are 10,000 records to update, you might want to separate 
> those into a number of files, so you can confirm the process is 
> proceeding as expected. (It will not be a rapid process).
> An alternative is to customize appropriate stub sub routines in 
> /home/httpd/lib/perl/localenroll.pm on your library server, so they 
> can access campus directory information (e.g., LDAP) and then as 
> Domain Coordinator configure automated updates:
> Main Menu -> Set domain configuration -> Display (Auto-update settings 
> checked)
> You will find information about that in the Domain Coordination 
> manual, e.g., http://loncapa3.physics.sc.edu/adm/help/domain.manual.pdf
> see: section 2.9 "Identity Management: Automated Updates of User 
> Information" and section 4.4 "Institutional Directory Inform".
> Additional notes:
> 1. If you have command line access to the LON-CAPA library server in 
> your domain, you can view the existing username => student ID mapping 
> using:
> /home/httpd/perl/debug/dump_db.pl /home/httpd/lonUsers/sc/ids.db
> 2. As discussed elsewhere (see: 
> http://mail.lon-capa.org/pipermail/lon-capa-users/2012-October/004201.html), 
> the ids.db is a simple key => value GDBM file so if the same ID was 
> assigned to more than one student in LON-CAPA in the past, you will 
> not see all of those students.
> However, in such cases you can use MySQL on the command line to 
> retrieve all usernames for LON-CAPA users form the sc domain
> (see: 
> http://mail.lon-capa.org/pipermail/lon-capa-users/2012-October/004199.html)
> Stuart Raeburn
> LON-CAPA Academic Consortium
> Quoting Jeffrey Wilson <jwilson at sc.edu>:
>> Hi,
>> For security reasons we must replace the student/employee ID for all of
>> the existing
>> student records in our LonCapa database.  We have ~10K students in our
>> system so the
>> existing one-student-at-a-time GUI seems to not be the right tool for
>> the task.
>> Is there any way to do batch processing of the student database? Are
>> there scripts that
>> we can run at the command line to do this?
>> Thanks,
>> Jeff Wilson
>> _______________________________________________
>> LON-CAPA-admin mailing list
>> LON-CAPA-admin at mail.lon-capa.org
>> http://mail.lon-capa.org/mailman/listinfo/lon-capa-admin
> _______________________________________________
> LON-CAPA-admin mailing list
> LON-CAPA-admin at mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-admin

More information about the LON-CAPA-admin mailing list