Diff for /loncom/enrollment/Autoupdate.pl between versions 1.2 and 1.5

version 1.2, 2007/02/26 20:52:55 version 1.5, 2007/05/11 17:25:28
Line 1 Line 1
 #!/usr/bin/perl  #!/usr/bin/perl
 #  #
 # Automated Userinfo update script  # Automated Userinfo update script
   # $Id$
 #  #
 # Copyright Michigan State University Board of Trustees  # Copyright Michigan State University Board of Trustees
 #  #
Line 29 Line 30
     use localenroll;      use localenroll;
     use Apache::lonnet;      use Apache::lonnet;
     use Apache::loncommon;      use Apache::loncommon;
       use Apache::lonlocal;
       use LONCAPA::Configuration;
     use LONCAPA;      use LONCAPA;
   
       my $perlvarref = LONCAPA::Configuration::read_conf('loncapa.conf');
       my $hostid = $perlvarref->{'lonHostID'}; 
     my @info = ('inststatus','lockedname','lastname','firstname','id');      my @info = ('inststatus','lockedname','lastname','firstname','id');
     # find out which users we need to examine      # find out which users we need to examine
     my @domains = sort(&Apache::lonnet::current_machine_domains());      my @domains = sort(&Apache::lonnet::current_machine_domains());
     foreach my $dom (@domains) {      foreach my $dom (@domains) {
           my $primaryhost_id = &Apache::lonnet::domain($dom,'primary');
           if ($primaryhost_id ne $hostid) {
               next;
           } 
         my %domconfig = &Apache::lonnet::get_dom('configuration',['autoupdate'],          my %domconfig = &Apache::lonnet::get_dom('configuration',['autoupdate'],
                                                  $dom);                                                   $dom);
         #only run if configured to          #only run if configured to
Line 112 Line 121
                                 if ($changes{'id'} || $changes{'fullname'}) {                                  if ($changes{'id'} || $changes{'fullname'}) {
                                     my %roleshash =                                       my %roleshash = 
                                         &Apache::lonnet::get_my_roles($uname,                                          &Apache::lonnet::get_my_roles($uname,
                                                   $dom,\@types,\@roles,\@cdoms);                                                    $dom,'userroles',\@types,\@roles,\@cdoms);
                                     foreach my $item (%roleshash) {                                      foreach my $item (%roleshash) {
                                         my ($cnum,$cdom,$role) = split(/:/,$item);                                          my ($cnum,$cdom,$role) = split(/:/,$item);
                                         my ($start,$end) = split(/:/,$roleshash{$item});                                          my ($start,$end) = split(/:/,$roleshash{$item});
Line 136 Line 145
                         } else {                          } else {
                             if (!exists($users{$instids{$userhash{'id'}}})) {                              if (!exists($users{$instids{$userhash{'id'}}})) {
                                 $unamechg{$uname} = $instids{$userhash{'id'}};                                  $unamechg{$uname} = $instids{$userhash{'id'}};
                                   print &mt('Username change to [_1] detected for [_2] in domain [_3].',$unamechg{$uname},$uname,$dom)."\n";
                             }                              }
                         }                          }
                     }                      }
                 }                  }
             }              }
         }          }
           if (keys(%possnames) > 0) {
               foreach my $uname (keys(%possnames)) {
                   my $altnames = join(' or ',@{$possnames{$uname}});
                   print &mt('Possible username change to [_1] detected for [_2] in domain [_3].',$altnames,$uname,$dom)."\n";
               }
           }
     }      }
   
   
 sub descend_tree {  sub descend_tree {
     my ($dir,$depth,$alldomusers) = @_;      my ($dir,$depth,$alldomusers) = @_;
     if (-d $dir) {      if (-d $dir) {

Removed from v.1.2  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>