[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm

H. K. Ng hkng@fsu.edu
Mon, 27 Aug 2007 10:20:52 -0400


Hi Stuart,

May not be a good idea to remove starting or trailing spaces if it is 
contains (or begins with - trailing space) since this eliminates 
names like "von Braum" etc. So if we search (for contains or begins 
with), a string like " brau" or "von " should be allowed. I guess, if 
need be, this should be domain specific.

-hk


>   Modified files:
>     /loncom/interface   loncreateuser.pm
>   Log:
>   bug 5390 - only check if search term is valid username for uname 
> type search
>   - trim leading and trailing spaces from search term.
>
>
>Index: loncom/interface/loncreateuser.pm
>diff -u loncom/interface/loncreateuser.pm:1.175 
>loncom/interface/loncreateuser.pm:1.176
>--- loncom/interface/loncreateuser.pm:1.175     Thu Aug 16 17:48:20 2007
>+++ loncom/interface/loncreateuser.pm     Sat Aug 25 13:46:24 2007
>@@ -1,7 +1,7 @@
>  # The LearningOnline Network with CAPA
>  # Create a user
>  #
>-# $Id: loncreateuser.pm,v 1.175 2007/08/16 21:48:20 raeburn Exp $
>+# $Id: loncreateuser.pm,v 1.176 2007/08/25 17:46:24 raeburn Exp $
>  #
>  # Copyright Michigan State University Board of Trustees
>  #
>@@ -2194,8 +2194,10 @@
>      my %inst_matches;
>      my %srch_results;
>      my ($response,$state,$forcenewuser);
>+    $srch->{'srchterm'} =~ s/^\s+//;
>+    $srch->{'srchterm'} =~ s/\s+$//;
>
>-    if ($srch->{'srchby'} !~ /^(uname|lastname|lastfirst)$/) {
>+    if ($srch->{'srchby'} !~ /^(uname|lastname|lastfirst)$/) {
>          $response = &mt('Invalid search.');
>      }
>      if ($srch->{'srchin'} !~ /^(crs|dom|alc|instd)$/) {
>@@ -2215,8 +2217,10 @@
>      }
>      if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs') ||
>          ($srch->{'srchin'} eq 'alc')) {
>-        if ($srch->{'srchterm'} !~ /^$match_username$/) {
>-            $response = &mt('You must specify a valid username. 
>Only the following are allowed: letters numbers - . @');
>+        if ($srch->{'srchby'} eq 'uname') {
>+            if ($srch->{'srchterm'} !~ /^$match_username$/) {
>+                $response = &mt('You must specify a valid username. 
>Only the following are allowed: letters numbers - . @');
>+            }
>          }
>      }
>      if ($srch->{'srchin'} eq 'instd') {
>
>
>_______________________________________________
>LON-CAPA-cvs mailing list
>LON-CAPA-cvs@mail.lon-capa.org
>http://mail.lon-capa.org/mailman/listinfo/lon-capa-cvs