--- loncom/interface/loncreateuser.pm 2002/08/07 18:49:36 1.38 +++ loncom/interface/loncreateuser.pm 2003/07/18 13:45:14 1.60 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.38 2002/08/07 18:49:36 matthew Exp $ +# $Id: loncreateuser.pm,v 1.60 2003/07/18 13:45:14 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -44,10 +44,9 @@ # 2/14,2/17,2/19,2/20,2/21,2/22,2/23,3/2,3/17,3/24,04/12 Gerd Kortemeyer # April Guy Albertelli # 05/10,10/16 Gerd Kortemeyer -# 11/12,11/13,11/15 Scott Harrison # 02/11/02 Matthew Hall # -# $Id: loncreateuser.pm,v 1.38 2002/08/07 18:49:36 matthew Exp $ +# $Id: loncreateuser.pm,v 1.60 2003/07/18 13:45:14 www Exp $ ### package Apache::loncreateuser; @@ -55,6 +54,7 @@ package Apache::loncreateuser; use strict; use Apache::Constants qw(:common :http); use Apache::lonnet; +use Apache::loncommon; my $loginscript; # piece of javascript used in two separate instances my $generalrule; @@ -71,60 +71,113 @@ BEGIN { my %param = ( formname => 'document.cu', kerb_def_dom => $krbdefdom ); - $loginscript = &Apache::loncommon::authform_header(%param); +# no longer static due to configurable kerberos defaults +# $loginscript = &Apache::loncommon::authform_header(%param); $generalrule = &Apache::loncommon::authform_authorwarning(%param); $authformnop = &Apache::loncommon::authform_nochange(%param); - $authformkrb = &Apache::loncommon::authform_kerberos(%param); +# no longer static due to configurable kerberos defaults +# $authformkrb = &Apache::loncommon::authform_kerberos(%param); $authformint = &Apache::loncommon::authform_internal(%param); $authformfsys = &Apache::loncommon::authform_filesystem(%param); $authformloc = &Apache::loncommon::authform_local(%param); } + +# ======================================================= Existing Custom Roles + +sub my_custom_roles { + my %returnhash=(); + my %rolehash=&Apache::lonnet::dump('roles'); + foreach (keys %rolehash) { + if ($_=~/^rolesdef\_(\w+)$/) { + $returnhash{$_}=$_; + } + } + return %returnhash; +} + +# ==================================================== Figure out author access + +sub authorpriv { + my ($auname,$audom)=@_; + if (($auname ne $ENV{'user.name'}) || + (($audom ne $ENV{'user.domain'}) && + ($audom ne $ENV{'request.role.domain'}))) { return ''; } + unless (&Apache::lonnet::allowed('cca',$audom)) { return ''; } + return 1; +} + # =================================================================== Phase one -sub phase_one { +sub print_username_entry_form { my $r=shift; - my $defdom=$ENV{'user.domain'}; + my $defdom=$ENV{'request.role.domain'}; my @domains = &Apache::loncommon::get_domains(); my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain'); + my $bodytag =&Apache::loncommon::bodytag( + 'Create Users, Change User Privileges'); + my $selscript=&Apache::loncommon::studentbrowser_javascript(); + my $sellink=&Apache::loncommon::selectstudent_link + ('crtuser','ccuname','ccdomain'); + my %existingroles=&my_custom_roles(); + my $choice=&Apache::loncommon::select_form('make new role','rolename', + ('make new role' => 'Generate new role ...',%existingroles)); $r->print(<<"ENDDOCUMENT"); <html> <head> <title>The LearningOnline Network with CAPA</title> +$selscript </head> -<body bgcolor="#FFFFFF"> -<h1>Create User, Change User Privileges</h1> -<form action=/adm/createuser method=post> -<input type=hidden name=phase value=two> -<p> -Username: <input type=text size=15 name=ccuname><br> -Domain: $domform -</p> -<input type=submit value="Continue"> +$bodytag +<form action="/adm/createuser" method="post" name="crtuser"> +<input type="hidden" name="phase" value="get_user_info"> +<h2>Set Individual User Roles</h2> +<table> +<tr><td>Username:</td><td><input type="text" size="15" name="ccuname"> +</td><td rowspan="2">$sellink</td></tr><tr><td> +Domain:</td><td>$domform</td></tr> +</table> +<input name="userrole" type="submit" value="User Roles" /> </form> +<form action="/adm/createuser" method="post" name="docustom"> +<input type="hidden" name="phase" value="selected_custom_edit"> +<h2>Edit Custom Role Privileges</h2> +Name of Role: $choice <input type="text" size="15" name="newrolename" /><br /> +<input name="customeditor" type="submit" value="Custom Role Editor" /> </body> </html> ENDDOCUMENT } # =================================================================== Phase two -sub phase_two { +sub print_user_modification_page { my $r=shift; my $ccuname=$ENV{'form.ccuname'}; my $ccdomain=$ENV{'form.ccdomain'}; - $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/; - my $krbdefdom=$1; - $krbdefdom=~tr/a-z/A-Z/; + $ccuname=~s/\W//gs; + $ccdomain=~s/\W//gs; + + unless (($ccuname) && ($ccdomain)) { + &print_username_entry_form($r); + return; + } + + my $defdom=$ENV{'request.role.domain'}; + + my ($krbdef,$krbdefdom) = + &Apache::loncommon::get_kerberos_defaults($defdom); + my %param = ( formname => 'document.cu', - kerb_def_dom => $krbdefdom + kerb_def_dom => $krbdefdom, + kerb_def_auth => $krbdef ); $loginscript = &Apache::loncommon::authform_header(%param); - - my $defdom=$ENV{'user.domain'}; + $authformkrb = &Apache::loncommon::authform_kerberos(%param); $ccuname=~s/\W//g; $ccdomain=~s/\W//g; + my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); my $dochead =<<"ENDDOCHEAD"; <html> <head> @@ -137,14 +190,7 @@ sub phase_two { parmwin.close(); } - function pjump(type,dis,value,marker,ret,call) { - parmwin=window.open("/adm/rat/parameter.html?type="+escape(type) - +"&value="+escape(value)+"&marker="+escape(marker) - +"&return="+escape(ret) - +"&call="+escape(call)+"&name="+escape(dis),"LONCAPAparms", - "height=350,width=350,scrollbars=no,menubar=no"); - - } + $pjump_def function dateset() { eval("document.cu."+document.cu.pres_marker.value+ @@ -154,12 +200,12 @@ sub phase_two { </script> </head> -<body bgcolor="#FFFFFF"> -<img align="right" src="/adm/lonIcons/lonlogos.gif"> ENDDOCHEAD + $r->print(&Apache::loncommon::bodytag( + 'Create Users, Change User Privileges')); my $forminfo =<<"ENDFORMINFO"; <form action="/adm/createuser" method="post" name="cu"> -<input type="hidden" name="phase" value="three"> +<input type="hidden" name="phase" value="update_user_data"> <input type="hidden" name="ccuname" value="$ccuname"> <input type="hidden" name="ccdomain" value="$ccdomain"> <input type="hidden" name="pres_value" value="" > @@ -169,7 +215,7 @@ ENDFORMINFO my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain); my %incdomains; my %inccourses; - foreach (%Apache::lonnet::hostdom) { + foreach (values(%Apache::lonnet::hostdom)) { $incdomains{$_}=1; } foreach (keys(%ENV)) { @@ -218,7 +264,7 @@ ENDNEWUSER $dochead <h1>Change User Privileges</h1> $forminfo -<h2>User "$ccuname" in domain $ccdomain </h2> +<h2>User "$ccuname" in domain "$ccdomain"</h2> ENDCHANGEUSER # Get the users information my %userenv = &Apache::lonnet::get('environment', @@ -236,7 +282,7 @@ END foreach ('firstname','middlename','lastname','generation') { if (&Apache::lonnet::allowed('mau',$ccdomain)) { $r->print(<<"END"); -<td><input type="text" name="c$_" value="$userenv{$_}" size="15"/></td> +<td><input type="text" name="c$_" value="$userenv{$_}" size="15" /></td> END } else { $r->print('<td>'.$userenv{$_}.'</td>'); @@ -254,7 +300,7 @@ END <hr /> <h3>Revoke Existing Roles</h3> <table border=2> -<tr><th>Revoke</th><th>Role</th><th>Extent</th><th>Start</th><th>End</th> +<tr><th>Revoke</th><th>Delete</th><th>Role</th><th>Extent</th><th>Start</th><th>End</th> END foreach my $area (keys(%rolesdump)) { next if ($area =~ /^rolesdef/); @@ -265,14 +311,29 @@ END split(/_/,$role); my $bgcol='ffffff'; my $allowed=0; + my $delallowed=0; if ($area =~ /^\/(\w+)\/(\d\w+)/ ) { + my ($coursedom,$coursedir) = ($1,$2); + # $1.'_'.$2 is the course id (eg. 103_12345abcef103l3). my %coursedata= &Apache::lonnet::coursedescription($1.'_'.$2); - my $carea='Course: '.$coursedata{'description'}; + my $carea; + if (defined($coursedata{'description'})) { + $carea='Course: '.$coursedata{'description'}. + '<br />Domain: '.$coursedom.(' 'x8). + &Apache::loncommon::syllabuswrapper('Syllabus',$coursedir,$coursedom); + } else { + $carea='Unavailable course: '.$area; + } $inccourses{$1.'_'.$2}=1; - if (&Apache::lonnet::allowed('c'.$role_code,$1.'/'.$2)) { + if ((&Apache::lonnet::allowed('c'.$role_code,$1.'/'.$2)) || + (&Apache::lonnet::allowed('c'.$role_code,$ccdomain))) { $allowed=1; } + if ((&Apache::lonnet::allowed('dro',$1)) || + (&Apache::lonnet::allowed('dro',$ccdomain))) { + $delallowed=1; + } # Compute the background color based on $area $bgcol=$1.'_'.$2; $bgcol=~s/[^8-9b-e]//g; @@ -284,27 +345,27 @@ END } else { # Determine if current user is able to revoke privileges if ($area=~ /^\/(\w+)\//) { - if (&Apache::lonnet::allowed('c'.$role_code,$1)) { + if ((&Apache::lonnet::allowed('c'.$role_code,$1)) || + (&Apache::lonnet::allowed('c'.$role_code,$ccdomain))) { $allowed=1; } + if (((&Apache::lonnet::allowed('dro',$1)) || + (&Apache::lonnet::allowed('dro',$ccdomain))) && + ($role_code ne 'dc')) { + $delallowed=1; + } } else { if (&Apache::lonnet::allowed('c'.$role_code,'/')) { $allowed=1; } } } - # I have no idea what the hell the above code does - # So the following is a check: - if ($allowed) { - # If we are looking at a co-author role, make sure it is - # for the current users construction space before we let - # them revoke it. - if (($role_code eq 'ca') && - ($ENV{'request.role'} !~ /^dc/)) { - if ($area !~ - /^\/$ENV{'user.domain'}\/$ENV{'user.name'}/) { - $allowed = 0; - } + if ($role_code eq 'ca') { + $area=~/\/(\w+)\/(\w+)/; + if (&authorpriv($2,$1)) { + $allowed=1; + } else { + $allowed=0; } } my $row = ''; @@ -314,6 +375,16 @@ END if (($active) && ($allowed)) { $row.= '<input type="checkbox" name="rev:'.$thisrole.'">'; } else { + if ($active) { + $row.=' '; + } else { + $row.='expired or revoked'; + } + } + $row.='</td><td>'; + if ($delallowed) { + $row.= '<input type="checkbox" name="del:'.$thisrole.'">'; + } else { $row.=' '; } $row.= '</td><td>'.&Apache::lonnet::plaintext($role_code). @@ -328,21 +399,21 @@ END $r->print('</table>'); } # End of unless my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain); - if ($currentauth=~/^krb4:/) { - $currentauth=~/^krb4:(.*)/; - my $krbdefdom2=$1; + if ($currentauth=~/^krb(4|5):/) { + $currentauth=~/^krb(4|5):(.*)/; + my $krbdefdom=$1; my %param = ( formname => 'document.cu', kerb_def_dom => $krbdefdom ); $loginscript = &Apache::loncommon::authform_header(%param); } # Check for a bad authentication type - unless ($currentauth=~/^krb4:/ or + unless ($currentauth=~/^krb(4|5):/ or $currentauth=~/^unix:/ or $currentauth=~/^internal:/ or $currentauth=~/^localauth:/ ) { # bad authentication scheme - if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) { + if (&Apache::lonnet::allowed('mau',$ENV{'request.role.domain'})) { $r->print(<<ENDBADAUTH); <hr /> <script type="text/javascript" language="Javascript"> @@ -375,7 +446,7 @@ ENDBADAUTH } else { # Authentication type is valid my $authformcurrent=''; my $authform_other=''; - if ($currentauth=~/^krb4:/) { + if ($currentauth=~/^krb(4|5):/) { $authformcurrent=$authformkrb; $authform_other="<p>$authformint</p>\n". "<p>$authformfsys</p><p>$authformloc</p>"; @@ -395,17 +466,8 @@ ENDBADAUTH $authform_other="<p>$authformkrb</p>". "<p>$authformint</p><p>$authformfsys</p>"; } - $authformcurrent=<<ENDCURRENTAUTH; -<table border='1'> -<tr> -<td><font color='#ff0000'>* * * WARNING * * *</font></td> -<td><font color='#ff0000'>* * * WARNING * * *</font></td> -</tr> -<tr><td bgcolor='#cbbcbb'>$authformcurrent</td> -<td bgcolor='#cbbcbb'>Changing this value will overwrite existing authentication for the user; you should notify the user of this change.</td></tr> -</table> -ENDCURRENTAUTH - if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) { + $authformcurrent.=' <i>(will override current values)</i><br />'; + if (&Apache::lonnet::allowed('mau',$ENV{'request.role.domain'})) { # Current user has login modification privileges $r->print(<<ENDOTHERAUTHS); <hr /> @@ -426,10 +488,11 @@ ENDOTHERAUTHS # # Co-Author # - - if (&Apache::lonnet::allowed('cca',$ENV{'user.domain'})) { + if (&authorpriv($ENV{'user.name'},$ENV{'request.role.domain'}) && + ($ENV{'user.name'} ne $ccuname || $ENV{'user.domain'} ne $ccdomain)) { + # No sense in assigning co-author role to yourself my $cuname=$ENV{'user.name'}; - my $cudom=$ENV{'user.domain'}; + my $cudom=$ENV{'request.role.domain'}; $r->print(<<ENDCOAUTH); <h4>Construction Space</h4> <table border=2><tr><th>Activate</th><th>Role</th><th>Extent</th> @@ -485,7 +548,7 @@ ENDDROW } # ================================================================= Phase Three -sub phase_three { +sub update_user_data { my $r=shift; my $uhome=&Apache::lonnet::homeserver($ENV{'form.ccuname'}, $ENV{'form.ccdomain'}); @@ -498,9 +561,14 @@ sub phase_three { <head> <title>The LearningOnline Network with CAPA</title> </head> -<body bgcolor="#FFFFFF"> -<img align="right" src="/adm/lonIcons/lonlogos.gif"> ENDTHREEHEAD + my $title; + if (exists($ENV{'form.makeuser'})) { + $title='Set Privileges for New User'; + } else { + $title='Modify User Privileges'; + } + $r->print(&Apache::loncommon::bodytag($title)); # Check Inputs if (! $ENV{'form.ccuname'} ) { $r->print($error.'No login name specified.'.$end); @@ -535,7 +603,8 @@ ENDTHREEHEAD my $amode=''; my $genpwd=''; if ($ENV{'form.login'} eq 'krb') { - $amode='krb4'; + $amode='krb'; + $amode.=$ENV{'form.krbver'}; $genpwd=$ENV{'form.krbarg'}; } elsif ($ENV{'form.login'} eq 'int') { $amode='internal'; @@ -560,7 +629,6 @@ ENDTHREEHEAD if ($ENV{'form.makeuser'}) { # Create a new user $r->print(<<ENDNEWUSERHEAD); -<h1>Create User</h1> <h3>Creating user "$ENV{'form.ccuname'}" in domain "$ENV{'form.ccdomain'}"</h2> ENDNEWUSERHEAD # Check for the authentication mode and password @@ -573,7 +641,7 @@ ENDNEWUSERHEAD if (lc($desiredhost) eq 'default') { $desiredhost = undef; } else { - my %home_servers = &Apache::loncommon::get_home_servers + my %home_servers = &Apache::loncommon::get_library_servers ($ENV{'form.ccdomain'}); if (! exists($home_servers{$desiredhost})) { $r->print($error.'Invalid home server specified'); @@ -596,7 +664,6 @@ ENDNEWUSERHEAD ($ENV{'form.login'} ne '' )) { # Modify user privileges $r->print(<<ENDMODIFYUSERHEAD); -<h1>Change User Privileges</h1> <h2>User "$ENV{'form.ccuname'}" in domain "$ENV{'form.ccdomain'}"</h2> ENDMODIFYUSERHEAD if (! $amode || ! $genpwd) { @@ -691,47 +758,68 @@ END # Revoke roles if ($_=~/^form\.rev/) { if ($_=~/^form\.rev\:([^\_]+)\_([^\_]+)$/) { - $r->print('Revoking '.$2.' in '.$1.': '. + $r->print('Revoking '.$2.' in '.$1.': <b>'. + &Apache::lonnet::assignrole($ENV{'form.ccdomain'}, + $ENV{'form.ccuname'},$1,$2,$now).'</b><br>'); + if ($2 eq 'st') { + $1=~/^\/(\w+)\/(\w+)/; + my $cid=$1.'_'.$2; + $r->print('Drop from classlist: <b>'. + &Apache::lonnet::critical('put:'. + $ENV{'course.'.$cid.'.domain'}.':'. + $ENV{'course.'.$cid.'.num'}.':classlist:'. + &Apache::lonnet::escape($ENV{'form.ccuname'}.':'. + $ENV{'form.ccdomain'}).'='. + &Apache::lonnet::escape($now.':'), + $ENV{'course.'.$cid.'.home'}).'</b><br>'); + } + } + } elsif ($_=~/^form\.del/) { + if ($_=~/^form\.del\:([^\_]+)\_([^\_]+)$/) { + $r->print('Deleting '.$2.' in '.$1.': '. &Apache::lonnet::assignrole($ENV{'form.ccdomain'}, - $ENV{'form.ccuname'},$1,$2,$now).'<br>'); + $ENV{'form.ccuname'},$1,$2,$now,0,1).'<br>'); if ($2 eq 'st') { $1=~/^\/(\w+)\/(\w+)/; my $cid=$1.'_'.$2; - $r->print('Drop from classlist: '. + $r->print('Drop from classlist: <b>'. &Apache::lonnet::critical('put:'. $ENV{'course.'.$cid.'.domain'}.':'. $ENV{'course.'.$cid.'.num'}.':classlist:'. &Apache::lonnet::escape($ENV{'form.ccuname'}.':'. $ENV{'form.ccdomain'}).'='. &Apache::lonnet::escape($now.':'), - $ENV{'course.'.$cid.'.home'}).'<br>'); + $ENV{'course.'.$cid.'.home'}).'</b><br>'); } } } elsif ($_=~/^form\.act/) { if ($_=~/^form\.act\_([^\_]+)\_([^\_]+)\_([^\_]+)$/) { # Activate roles for sections with 3 id numbers # set start, end times, and the url for the class - my $start = ( $ENV{'form.start_'.$1.'_'.$2} ? - $ENV{'form.start_'.$1.'_'.$2} : + + my $start = ( $ENV{'form.start_'.$1.'_'.$2.'_'.$3} ? + $ENV{'form.start_'.$1.'_'.$2.'_'.$3} : $now ); - my $end = ( $ENV{'form.end_'.$1.'_'.$2} ? - $ENV{'form.end_'.$1.'_'.$2} : + my $end = ( $ENV{'form.end_'.$1.'_'.$2.'_'.$3} ? + $ENV{'form.end_'.$1.'_'.$2.'_'.$3} : 0 ); my $url='/'.$1.'/'.$2; if ($ENV{'form.sec_'.$1.'_'.$2.'_'.$3}) { $url.='/'.$ENV{'form.sec_'.$1.'_'.$2.'_'.$3}; } # Assign the role and report it - $r->print('Assigning: '.$3.' in '.$url.': '. + $r->print('Assigning: '.$3.' in '.$url. + ($start?', starting '.localtime($start):''). + ($end?', ending '.localtime($end):'').': <b>'. &Apache::lonnet::assignrole( $ENV{'form.ccdomain'},$ENV{'form.ccuname'}, $url,$3,$end,$start). - '<br>'); + '</b><br>'); # Handle students differently if ($3 eq 'st') { $url=~/^\/(\w+)\/(\w+)/; my $cid=$1.'_'.$2; - $r->print('Add to classlist: '. + $r->print('Add to classlist: <b>'. &Apache::lonnet::critical( 'put:'.$ENV{'course.'.$cid.'.domain'}.':'. $ENV{'course.'.$cid.'.num'}.':classlist:'. @@ -740,7 +828,7 @@ END $ENV{'form.ccdomain'} ).'='. &Apache::lonnet::escape($end.':'.$start), $ENV{'course.'.$cid.'.home'}) - .'<br>'); + .'</b><br>'); } } elsif ($_=~/^form\.act\_([^\_]+)\_([^\_]+)$/) { # Activate roles for sections with two id numbers @@ -754,16 +842,72 @@ END my $url='/'.$1.'/'; # Assign the role and report it. $r->print('Assigning: '.$2.' in '.$url.': '. + ($start?', starting '.localtime($start):''). + ($end?', ending '.localtime($end):'').': <b>'. &Apache::lonnet::assignrole( $ENV{'form.ccdomain'},$ENV{'form.ccuname'}, $url,$2,$end,$start) - .'<br>'); + .'</b><br>'); } } } # End of foreach (keys(%ENV)) $r->print('</body></html>'); } +# ========================================================== Custom Role Editor + +sub custom_role_editor { + my $r=shift; + my $rolename=$ENV{'form.rolename'}; + + if ($rolename eq 'make new role') { + $rolename=$ENV{'form.newrolename'}; + } + + $rolename=~s/\W//gs; + + unless ($rolename) { + &print_username_entry_form($r); + return; + } + + $r->print(&Apache::loncommon::bodytag( + 'Create Users, Change User Privileges').'<h2>'); + my ($rdummy,$roledef)= + &Apache::lonnet::get('roles',["rolesdef_$rolename"]); +# ------------------------------------------------------- Does this role exist? + if (($rdummy ne 'con_lost') && ($roledef ne '')) { + $r->print('Existing Role "'); + } else { + $r->print('New Role "'); + $roledef=''; + } + $r->print($rolename.'"</h2>'); +# ------------------------------------------------------- What can be assigned? + my %full=(); + my %courselevel=(); + foreach (split(/\:/,$Apache::lonnet::pr{'cr:c'})) { + my ($priv,$restrict)=split(/\&/,$_); + unless ($restrict) { $restrict='F'; } + $courselevel{$priv}=$restrict; + $full{$priv}=1; + } + my %domainlevel=(); + foreach (split(/\:/,$Apache::lonnet::pr{'cr:d'})) { + my ($priv,$restrict)=split(/\&/,$_); + unless ($restrict) { $restrict='F'; } + $domainlevel{$priv}=$restrict; + $full{$priv}=1; + } + $r->print('<table border="2"><tr><th>Privilege</th><th>Course Level</th><th>Domain Level</th></tr>'); + foreach (sort keys %full) { + $r->print('<tr><td>'.&Apache::lonnet::plaintext($_).'</td><td>'. + $courselevel{$_}.'</td><td>'.$domainlevel{$_}.'</td></tr>'); + } + $r->print('</table>'); + $r->print('Not yet implemented.'); +} + # ================================================================ Main Handler sub handler { my $r = shift; @@ -778,17 +922,19 @@ sub handler { (&Apache::lonnet::allowed('cin',$ENV{'request.course.id'})) || (&Apache::lonnet::allowed('ccr',$ENV{'request.course.id'})) || (&Apache::lonnet::allowed('cep',$ENV{'request.course.id'})) || - (&Apache::lonnet::allowed('cca',$ENV{'user.domain'})) || - (&Apache::lonnet::allowed('mau',$ENV{'user.domain'}))) { + (&Apache::lonnet::allowed('cca',$ENV{'request.role.domain'})) || + (&Apache::lonnet::allowed('mau',$ENV{'request.role.domain'}))) { $r->content_type('text/html'); $r->send_http_header; unless ($ENV{'form.phase'}) { - &phase_one($r); + &print_username_entry_form($r); } - if ($ENV{'form.phase'} eq 'two') { - &phase_two($r); - } elsif ($ENV{'form.phase'} eq 'three') { - &phase_three($r); + if ($ENV{'form.phase'} eq 'get_user_info') { + &print_user_modification_page($r); + } elsif ($ENV{'form.phase'} eq 'update_user_data') { + &update_user_data($r); + } elsif ($ENV{'form.phase'} eq 'selected_custom_edit') { + &custom_role_editor($r); } } else { $ENV{'user.error.msg'}= @@ -808,6 +954,7 @@ sub course_level_table { $thiscourse=~s:_:/:g; my %coursedata=&Apache::lonnet::coursedescription($thiscourse); my $area=$coursedata{'description'}; + if (!defined($area)) { $area='Unavailable course: '.$_; } my $bgcol=$thiscourse; $bgcol=~s/[^8-9b-e]//g; $bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',0,6);