[LON-CAPA-admin] Re: Re: Some questions

Stuart Raeburn raeburn at msu.edu
Thu Jan 29 09:57:48 EST 2009


Eric,

My recommendation would be to modify create_course_enroll.pl to query  
your LDAP service to retrieve the missing First Name or Last Name and,  
only if that fails to retrieve the missing data, then skip adding that  
student to the roster.

Something similar to the following where $vcuID is the unique  
identifier (i.e., VCU eID). I expect you'd use Net::LDAPS instead of  
Net::LDAP.  Details of the hostname of the LDAP service and the fields  
within the LDAP records may be different for your specific case.

# If first name and/or last name missing from record retrieved from SIS ...
my $($firstname,$lastname) = &ldap_check($vcuID);

sub ldap_check {
     my ($vcuID) = @_;
     my $ldap = Net::LDAP->new( 'ldap.vcu.edu' );
     my ($firstname,$lastname);
     if ($ldap) {
         $ldap->bind;
         my $mesg = $ldap->search(
                             base   => "dc=vcu, dc=edu",
                             filter => '(uid='.$vcuID.')',
                             attrs  => ['sn','givenName','uid'],
                           );
         if ($mesg->code) {
             $ldap->unbind;
             return ($firstname,$lastname);
         }
         foreach my $entry ($mesg->entries) {
             my $uname = $entry->get_value('uid');
             next if ($uname eq '');
             $firstname = $entry->get_value('givenName');
             $lastname = $entry->get_value('sn');
             last if ($firstname ne '' && $lastname ne '');
         }
         $ldap->unbind;
     }
     return ($firstname,$lastname);
}

Stuart Raeburn
MSU LON-CAPA group

Quoting Eric Harvey/FS/VCU <teharvey at vcu.edu>:

> It appears that occasionally our feed from SIS is missing the student
> First Name or Last Name but is not caught by create_course_enroll.pl (the
> custom script that creates roster XMLs for Auto-enrollments).
> I'm going to make a change to check for those as the user file is
> processed. If they are not present, they don't get included in the roster
> and are reported to course_enroll.log (which gets emailed to me nightly).
>
> Any advice on moving forward on this one?
>
> Thanks,
>
> Eric Harvey
> VCU Learning Systems






More information about the LON-CAPA-admin mailing list