Diff for /loncom/interface/lonuserutils.pm between versions 1.123 and 1.124

version 1.123, 2010/09/19 20:18:57 version 1.124, 2010/09/20 00:10:29
Line 3957  sub upfile_drop_add { Line 3957  sub upfile_drop_add {
                 $r->print($groupwarn.'<br />');                  $r->print($groupwarn.'<br />');
             }              }
         }          }
         my (%curr_rules,%got_rules,%alerts);          my (%curr_rules,%got_rules,%alerts,%cancreate);
         my %customroles = &my_custom_roles($crstype);          my %customroles = &my_custom_roles($crstype);
         my @permitted_roles =           my @permitted_roles = 
             &roles_on_upload($context,$setting,$crstype,%customroles);               &roles_on_upload($context,$setting,$crstype,%customroles);
           my %longtypes = &Apache::lonlocal::texthash(
                               official   => 'Institutional',
                               unofficial => 'Non-institutional',
                           );
           map { $cancreate{$_} = &can_create_user($domain,$context,$_); } keys(%longtypes);
         # Get new users list          # Get new users list
         foreach my $line (@userdata) {          foreach my $line (@userdata) {
             my @secs;              my @secs;
Line 4106  sub upfile_drop_add { Line 4111  sub upfile_drop_add {
                     my (%rulematch,%inst_results,%idinst_results);                      my (%rulematch,%inst_results,%idinst_results);
                     my $uhome=&Apache::lonnet::homeserver($username,$userdomain);                      my $uhome=&Apache::lonnet::homeserver($username,$userdomain);
                     if ($uhome eq 'no_host') {                      if ($uhome eq 'no_host') {
                         next if ($userdomain ne $domain);                          if ($userdomain ne $domain) {
                               $r->print('<br />'.
                                   &mt('[_1]: The domain specified ([_2]) is different to that of the course.',
                                       '<b>'.$username.'</b>',$userdomain).'<br />'.
                                   &mt('The user does not already exist, and you may not create a new user in a different domain.'));
                               next;
                           }
                         $checkid = 1;                          $checkid = 1;
                         $newuser = 1;                          $newuser = 1;
                           my $user = $username.':'.$domain;
                         my $checkhash;                          my $checkhash;
                         my $checks = { 'username' => 1 };                          my $checks = { 'username' => 1 };
                         $checkhash->{$username.':'.$domain} = { 'newuser' => 1, };                          $checkhash->{$username.':'.$domain} = { 'newuser' => 1, };
Line 4117  sub upfile_drop_add { Line 4129  sub upfile_drop_add {
                             \%got_rules);                              \%got_rules);
                         if (ref($alerts{'username'}) eq 'HASH') {                          if (ref($alerts{'username'}) eq 'HASH') {
                             if (ref($alerts{'username'}{$domain}) eq 'HASH') {                              if (ref($alerts{'username'}{$domain}) eq 'HASH') {
                                 next if ($alerts{'username'}{$domain}{$username});                                  if ($alerts{'username'}{$domain}{$username}) {
                                       $r->print('<br />'.
                                                 &mt('[_1]: matches the username format at your institution, but is not known to your directory service.','<b>'.$username.'</b>').'<br />'.
                                                 &mt('Consequently, the user was not created.'));
                                       next;
                                   }
                               }
                           }
                           my $usertype = 'unofficial';
                           if (ref($rulematch{$user}) eq 'HASH') {
                               if ($rulematch{$user}{'username'}) {
                                   $usertype = 'official';
                             }                              }
                         }                          }
                           unless ($cancreate{$usertype}) {
                               my $showtype = $longtypes{$usertype};
                               $r->print('<br />'.
                                         &mt("[_1]: The user does not exist, and you are not permitted to create users of type: $showtype.",'<b>'.$username.'</b>'));
                               next;
                           }
                     } else {                      } else {
                         if ($context eq 'course' || $context eq 'author') {                          if ($context eq 'course' || $context eq 'author') {
                             if ($userdomain eq $domain ) {                              if ($userdomain eq $domain ) {
Line 4170  sub upfile_drop_add { Line 4199  sub upfile_drop_add {
                                 \%got_rules);                                  \%got_rules);
                             if (ref($alerts{'id'}) eq 'HASH') {                              if (ref($alerts{'id'}) eq 'HASH') {
                                 if (ref($alerts{'id'}{$userdomain}) eq 'HASH') {                                  if (ref($alerts{'id'}{$userdomain}) eq 'HASH') {
                                     next if ($alerts{'id'}{$userdomain}{$id});                                      if ($alerts{'id'}{$userdomain}{$id}) {
                                           $r->print(&mt('[_1]: has a student/employee ID matching the format at your institution, but the ID is found by your directory service.',
                                                     '<b>'.$username.'</b>').'<br />'.
                                                     &mt('Consequently, the user was not created.'));
                                           next;
                                       }
                                 }                                  }
                             }                              }
                         }                          }

Removed from v.1.123  
changed lines
  Added in v.1.124


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