--- loncom/interface/loncreateuser.pm 2007/12/21 15:33:32 1.217 +++ loncom/interface/loncreateuser.pm 2008/01/02 09:16:59 1.228 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.217 2007/12/21 15:33:32 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.228 2008/01/02 09:16:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -76,30 +76,30 @@ my $authformfsys; my $authformloc; sub initialize_authen_forms { - my ($dom,$curr_authtype,$mode) = @_; - my ($krbdefdom)=( $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/); - $krbdefdom= uc($krbdefdom); - my %param = ( formname => 'document.cu', + my ($dom,$formname,$curr_authtype,$mode) = @_; + my ($krbdef,$krbdefdom) = &Apache::loncommon::get_kerberos_defaults($dom); + my %param = ( formname => $formname, kerb_def_dom => $krbdefdom, + kerb_def_auth => $krbdef, domain => $dom, ); my %abv_auth = &auth_abbrev(); - if ($curr_authtype =~ /^(krb4|krb5|internal|localauth|unix):$/) { + if ($curr_authtype =~ /^(krb4|krb5|internal|localauth|unix):(.*)$/) { my $long_auth = $1; + my $curr_autharg = $2; my %abv_auth = &auth_abbrev(); $param{'curr_authtype'} = $abv_auth{$long_auth}; if ($long_auth =~ /^krb(4|5)$/) { $param{'curr_kerb_ver'} = $1; + $param{'curr_autharg'} = $curr_autharg; } if ($mode eq 'modifyuser') { $param{'mode'} = $mode; } } -# no longer static due to configurable kerberos defaults -# $loginscript = &Apache::loncommon::authform_header(%param); + $loginscript = &Apache::loncommon::authform_header(%param); + $authformkrb = &Apache::loncommon::authform_kerberos(%param); $authformnop = &Apache::loncommon::authform_nochange(%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); @@ -233,7 +233,14 @@ sub print_username_entry_form { text=>"Single user search", faq=>282,bug=>'Instructor Interface',}); } - my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('User Management'); + my $helpitem = 'Course_Change_Privileges'; + if ($env{'form.action'} eq 'custom') { + $helpitem = 'Course_Editing_Custom_Roles'; + } elsif ($env{'form.action'} eq 'singlestudent') { + $helpitem = 'Course_Add_Student'; + } + my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('User Management', + $helpitem); my %existingroles=&Apache::lonuserutils::my_custom_roles(); my $choice=&Apache::loncommon::select_form('make new role','rolename', ('make new role' => 'Generate new role ...',%existingroles)); @@ -249,9 +256,6 @@ sub print_username_entry_form { 'enrl' => "to enroll one student", ); my $help = &Apache::loncommon::help_open_menu(undef,undef,282,'Instructor Interface'); - my $helpsiur=&Apache::loncommon::help_open_topic('Course_Change_Privileges'); - my $helpsist=&Apache::loncommon::help_open_topic('Course_Add_Student'); - my $helpecpr=&Apache::loncommon::help_open_topic('Course_Editing_Custom_Roles'); my $sellink=&Apache::loncommon::selectstudent_link('crtuser','srchterm','srchdomain'); if ($sellink) { $sellink = "$lt{'or'} ".$sellink; @@ -263,16 +267,16 @@ sub print_username_entry_form {
ENDCUSTOM } } else { - my $actiontext = $lt{'mod'}.$helpsiur; + my $actiontext = $lt{'mod'}; if ($env{'form.action'} eq 'singlestudent') { - $actiontext = $lt{'enrl'}.$helpsist; + $actiontext = $lt{'enrl'}; } $r->print("'.$lt{'act'}.' | '.$lt{'rol'}.' | '. + ''.$lt{'ext'}.' | '.$lt{'sta'}.' | '. + ''.$lt{'end'}.' | '."\n". + &Apache::loncommon::end_data_table_header_row()."\n". + &Apache::loncommon::start_data_table_row().' ++ + | +'.$lt{'cau'}.' | +'.$cudom.'_'.$cuname.' | ++ '.$lt{'ssd'}.' | ++'.$lt{'sed'}.' | '."\n". + &Apache::loncommon::end_data_table_row()."\n". + &Apache::loncommon::start_data_table_row()."\n". +'+ | '.$lt{'caa'}.' | +'.$cudom.'_'.$cuname.' | ++'.$lt{'ssd'}.' | ++'.$lt{'sed'}.' | '."\n". + &Apache::loncommon::end_data_table_row()."\n". + &Apache::loncommon::end_data_table()); + } elsif ($env{'request.role'} =~ /^au\./) { + if (!(&Apache::lonuserutils::authorpriv($env{'user.name'}, + $env{'request.role.domain'}))) { + $r->print(''. + &mt('You do not have privileges to assign co-author roles.'). + ''); + } elsif (($env{'user.name'} eq $ccuname) && + ($env{'user.domain'} eq $ccdomain)) { + $r->print(&mt('Assigning yourself a co-author or assistant co-author role in your own author area in Construction Space is not permitted')); + } + } + return $addrolesdisplay;; +} + +sub new_domain_roles { + my ($r) = @_; + my $addrolesdisplay = 0; + # + # Domain level + # + my $num_domain_level = 0; + my $domaintext = + ''.&mt('Activate').' | '.&mt('Role').' | '. + &mt('Extent').' | '. + ''.&mt('Start').' | '.&mt('End').' | '. + &Apache::loncommon::end_data_table_header_row(); + foreach my $thisdomain (sort(&Apache::lonnet::all_domains())) { + foreach my $role ('dc','li','dg','au','sc') { + if (&Apache::lonnet::allowed('c'.$role,$thisdomain)) { + my $plrole=&Apache::lonnet::plaintext($role); + my %lt=&Apache::lonlocal::texthash( + 'ssd' => "Set Start Date", + 'sed' => "Set End Date" + ); + $num_domain_level ++; + $domaintext .= +&Apache::loncommon::start_data_table_row(). +'+ | '.$plrole.' | +'.$thisdomain.' | ++'.$lt{'ssd'}.' | ++'.$lt{'sed'}.' | '. +&Apache::loncommon::end_data_table_row(); + } + } + } + $domaintext.= &Apache::loncommon::end_data_table(); + if ($num_domain_level > 0) { + $r->print($domaintext); + $addrolesdisplay = 1; + } + return $addrolesdisplay; +} + sub user_authentication { - my ($ccuname,$ccdomain,$krbdefdom,$abv_auth) = @_; + my ($ccuname,$ccdomain,$formname) = @_; my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain); - my ($loginscript,$outcome); - if ($currentauth=~/^(krb)(4|5):(.*)/) { - my $long_auth = $1.$2; - my $curr_kerb_ver = $2; - my $krbdefdom=$3; - my $curr_authtype = $abv_auth->{$long_auth}; - my %param = ( formname => 'document.cu', - kerb_def_dom => $krbdefdom, - domain => $ccdomain, - curr_authtype => $curr_authtype, - curr_kerb_ver => $curr_kerb_ver, - ); - $loginscript = &Apache::loncommon::authform_header(%param); - } + my $outcome; # Check for a bad authentication type if ($currentauth !~ /^(krb4|krb5|unix|internal|localauth):/) { # bad authentication scheme @@ -1236,7 +1232,8 @@ sub user_authentication { 'ld' => "Login Data" ); if (&Apache::lonnet::allowed('mau',$ccdomain)) { - &initialize_authen_forms($ccdomain); + &initialize_authen_forms($ccdomain,$formname); + my $choices = &Apache::lonuserutils::set_login($ccdomain,$authformkrb,$authformint,$authformloc); $outcome = <$lt{'gen'} | $lt{'id'} | $lt{'mail'} | -$lt{'disk'} | END + if ($showquota) { + $r->print(" +$lt{'disk'} | \n"); + } $r->print(&Apache::loncommon::end_data_table_header_row(). &Apache::loncommon::start_data_table_row()); $r->print(<<"END"); @@ -1922,8 +1895,11 @@ END$userenv{'generation'} | $userenv{'id'} | $userenv{'permanentemail'} | -$oldportfolioquota Mb $olddefquotatext | END + if ($showquota) { + $r->print(" +$oldportfolioquota Mb $olddefquotatext | \n"); + } $r->print(&Apache::loncommon::end_data_table_row(). &Apache::loncommon::start_data_table_row()); $r->print(<<"END"); @@ -1934,8 +1910,11 @@ END$env{'form.cgeneration'} | $env{'form.cid'} | $env{'form.cpermanentemail'} | -$newportfolioquota Mb $newdefquotatext | END + if ($showquota) { + $r->print(" +$newportfolioquota Mb $newdefquotatext | \n"); + } $r->print(&Apache::loncommon::end_data_table_row(). &Apache::loncommon::end_data_table().'
---|