--- loncom/interface/loncreateuser.pm 2002/02/11 15:37:58 1.25 +++ loncom/interface/loncreateuser.pm 2002/02/11 21:25:07 1.26 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.25 2002/02/11 15:37:58 matthew Exp $ +# $Id: loncreateuser.pm,v 1.26 2002/02/11 21:25:07 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -47,7 +47,7 @@ # 11/12,11/13,11/15 Scott Harrison # 02/11/02 Matthew Hall # -# $Id: loncreateuser.pm,v 1.25 2002/02/11 15:37:58 matthew Exp $ +# $Id: loncreateuser.pm,v 1.26 2002/02/11 21:25:07 matthew Exp $ ### package Apache::loncreateuser; @@ -207,7 +207,6 @@ ENDDOCUMENT } # =================================================================== Phase two - sub phase_two { my $r=shift; my $ccuname=$ENV{'form.ccuname'}; @@ -276,13 +275,11 @@ ENDFORMINFO } } if ($uhome eq 'no_host') { - $r->print(<print(<Create New User $forminfo

New user "$ccuname" in domain $ccdomain

-ENDNUSER - $r->print(<

Personal Data

@@ -307,22 +304,22 @@ $authformkrb $authformint $authformfsys $authformloc -ENDNUSER +ENDNEWUSER } else { # user already exists - $r->print(<print(<Change User Privileges $forminfo

User "$ccuname" in domain $ccdomain

-ENDCHUSER +ENDCHANGEUSER my $rolesdump=&Apache::lonnet::reply( "dump:$ccdomain:$ccuname:roles",$uhome); # Build up table of user roles to allow revocation of a role. - unless ($rolesdump eq 'con_lost') { + unless ($rolesdump eq 'con_lost' || $rolesdump =~ m/^error/i) { my $now=time; - $r->print('

Revoke Existing Roles

'. + $r->print('

Revoke Existing Roles

'. ''. - ''); + ''); foreach (split(/&/,$rolesdump)) { if ($_!~/^rolesdef\&/) { my ($area,$role)=split(/=/,$_); @@ -338,10 +335,7 @@ ENDCHUSER if (&Apache::lonnet::allowed('c'.$role_code,$1.'/'.$2)) { $allows=1; } - # What follows is an odd computation. It seems the value - # of the $area variable above is used to compute the - # background color. This makes sense, but I can't make - # heads or tail of the computation at this point.. + # Compute the background color based on $area $bgcol=$1.'_'.$2; $bgcol=~s/[^8-9b-e]//g; $bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',0,6); @@ -361,9 +355,9 @@ ENDCHUSER } } + $r->print(' @@ -459,8 +462,10 @@ END
RevokeRoleExtentStartEndStartEnd
'); my $active=1; if (($role_end_time) && ($now>$role_end_time)) { $active=0; } - $r->print('
'); if (!($active) && ($allows)) { $r->print(''); } else { @@ -387,16 +381,14 @@ ENDCHUSER my $krbdefdom2=$1; $loginscript=~s/vf\.krbdom\.value='.*?';/vf.krbdom.value='$krbdefdom2';/; } - # Here is where we'll have to check against the permissions of the - # user attempting to modify this users data. Only users with - # MAU (Modify Authentication User) permissions should be able to - # make these changes. I think a subroutine would be in order here. + # Check for a bad authentication type unless ($currentauth=~/^krb4:/ or $currentauth=~/^unix:/ or $currentauth=~/^internal:/ or $currentauth=~/^localauth:/ - ) { - $r->print(<print(< $loginscript ERROR: @@ -408,14 +400,25 @@ $authformkrb $authformint $authformfsys $authformloc -END - } - else { +ENDBADAUTH + } else { + # This user is not allowed to modify the users + # authentication scheme, so just notify them of the problem + $r->print(< +$loginscript + ERROR: +This user has an unrecognized authentication scheme ($currentauth). +Please alert a domain coordinator of this situation. +
+ENDBADAUTH + } + } else { # Authentication type is valid my $authformcurrent=''; - my $authformother=''; + my $authform_other=''; if ($currentauth=~/^krb4:/) { $authformcurrent=$authformkrb; - $authformother=$authformint.$authformfsys.$authformloc; + $authform_other=$authformint.$authformfsys.$authformloc; # embarrassing script hack here $loginscript=~s/login\[3\]/login\[4\]/; # loc $loginscript=~s/login\[2\]/login\[3\]/; # fsys @@ -424,7 +427,7 @@ END } elsif ($currentauth=~/^internal:/) { $authformcurrent=$authformint; - $authformother=$authformkrb.$authformfsys.$authformloc; + $authform_other=$authformkrb.$authformfsys.$authformloc; # embarrassing script hack here $loginscript=~s/login\[3\]/login\[4\]/; # loc $loginscript=~s/login\[2\]/login\[3\]/; # fsys @@ -433,7 +436,7 @@ END } elsif ($currentauth=~/^unix:/) { $authformcurrent=$authformfsys; - $authformother=$authformkrb.$authformint.$authformloc; + $authform_other=$authformkrb.$authformint.$authformloc; # embarrassing script hack here $loginscript=~s/login\[3\]/login\[4\]/; # loc $loginscript=~s/login\[1\]/login\[3\]/; # int @@ -442,7 +445,7 @@ END } elsif ($currentauth=~/^localauth:/) { $authformcurrent=$authformloc; - $authformother=$authformkrb.$authformint.$authformfsys; + $authform_other=$authformkrb.$authformint.$authformfsys; # embarrassing script hack here $loginscript=~s/login\[3\]/login\[loc\]/; # loc $loginscript=~s/login\[2\]/login\[4\]/; # fsys @@ -450,7 +453,7 @@ END $loginscript=~s/login\[0\]/login\[2\]/; # krb4 $loginscript=~s/login\[loc\]/login\[1\]/; # loc } - $authformcurrent=<
* * * WARNING * * *
$authformcurrent Changing this value will overwrite existing authentication for the user; you should notify the user of this change.
-END - $r->print(<print(< $loginscript

Change Current Login Data

@@ -468,9 +473,10 @@ $generalrule $authformnop $authformcurrent

Enter New Login Data

-$authformother -END - } +$authform_other +ENDOTHERAUTHS + } + } ## End of "check for bad authentication type" logic } ## End of new user/old user logic $r->print('

Add Roles

'); # @@ -529,49 +535,12 @@ ENDDROW # # Course level # - $r->print('

Course Level

'. - ''. - ''); - foreach (sort( keys(%inccourses))) { - my $thiscourse=$_; - my $protectedcourse=$_; - $thiscourse=~s:_:/:g; - my %coursedata=&Apache::lonnet::coursedescription($thiscourse); - my $area=$coursedata{'description'}; - my $bgcol=$thiscourse; - $bgcol=~s/[^8-9b-e]//g; - $bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',0,6); - foreach ('st','ta','ep','ad','in','cc') { - if (&Apache::lonnet::allowed('c'.$_,$thiscourse)) { - my $plrole=&Apache::lonnet::plaintext($_); - $r->print(" - - - - - - - -ENDROW - } - } - } - $r->print('
ActivateRoleExtentGroup/SectionStartEnd
$plrole$area"); - if ($_ ne 'cc') { - $r->print(""); - } else { $r->print(" "); } - $r->print(< -Set Start Date -Set End Date
'); - $r->print(''); - $r->print(''); + $r->print(&course_level_table(%inccourses)); + $r->print("
\n"); + $r->print(""); } # ================================================================= Phase Three - sub phase_three { my $r=shift; $r->print(< + +$plrole +$area +ENDEXTENT + if ($_ ne 'cc') { + $table .= < +ENDSECTION + } else { + $table .= <  +ENDSECTION + } + $table .= < +Set Start Date + +Set End Date +ENDTIMEENTRY + $table.= "\n"; + } + } + } + return '' if ($table eq ''); # return nothing if there is nothing + # in the table + my $result = <Course Level + + +$table +
ActivateRoleExtentGroup/SectionStartEnd
+ENDTABLE + return $result; +} + 1; __END__