--- loncom/interface/loncreateuser.pm 2007/08/25 19:52:29 1.177 +++ loncom/interface/loncreateuser.pm 2007/08/26 15:31:03 1.178 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.177 2007/08/25 19:52:29 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.178 2007/08/26 15:31:03 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2419,7 +2419,8 @@ sub directorysrch_check { lastfirst => 'last name, first name', lastname => 'last name', contains => 'contains', - exact => 'as exact match to' + exact => 'as exact match to', + begins => 'begins with', ); if ($can_search) { if (ref($dom_inst_srch{'directorysrch'}{'searchby'}) eq 'ARRAY') { @@ -2431,11 +2432,20 @@ sub directorysrch_check { } } if ($can_search) { - if (($dom_inst_srch{'directorysrch'}{'searchtypes'} eq 'specify') || - ($dom_inst_srch{'directorysrch'}{'searchtypes'} eq $srch->{'srchtype'})) { - return 'ok'; - } else { - return &mt('Directory search in domain [_1] is not available for the requested search type: "[_2]"',$srch->{'srchdomain'},$longtext{$srch->{'srchtype'}}); + if (ref($dom_inst_srch{'directorysrch'}{'searchtypes'}) eq 'ARRAY') { + if (grep(/^\Q$srch->{'srchtype'}\E/,@{$dom_inst_srch{'directorysrch'}{'searchtypes'}})) { + return 'ok'; + } else { + return &mt('Directory search in domain [_1] is not available for the requested search type: "[_2]"',$srch->{'srchdomain'},$longtext{$srch->{'srchtype'}}); + } + } else { + if ((($dom_inst_srch{'directorysrch'}{'searchtypes'} eq 'specify') && + ($srch->{'srchtype'} eq 'exact' || $srch->{'srchtype'} eq 'contains')) || + ($dom_inst_srch{'directorysrch'}{'searchtypes'} eq $srch->{'srchtype'})) { + return 'ok'; + } else { + return &mt('Directory search in domain [_1] is not available for the requested search type: "[_2]"',$srch->{'srchdomain'},$longtext{$srch->{'srchtype'}}); + } } } }