version 1.184.4.5, 2019/08/26 01:28:51
|
version 1.184.4.12, 2024/07/04 16:29:50
|
Line 103 sub modifystudent {
|
Line 103 sub modifystudent {
|
sub modifyuserrole { |
sub modifyuserrole { |
my ($context,$setting,$changeauth,$cid,$udom,$uname,$uid,$umode,$upass, |
my ($context,$setting,$changeauth,$cid,$udom,$uname,$uid,$umode,$upass, |
$first,$middle,$last,$gene,$sec,$forceid,$desiredhome,$email,$role, |
$first,$middle,$last,$gene,$sec,$forceid,$desiredhome,$email,$role, |
$end,$start,$checkid,$inststatus) = @_; |
$end,$start,$checkid,$inststatus,$emptyok) = @_; |
my ($scope,$userresult,$authresult,$roleresult,$idresult); |
my ($scope,$userresult,$authresult,$roleresult,$idresult); |
if ($setting eq 'course' || $context eq 'course') { |
if ($setting eq 'course' || $context eq 'course') { |
$scope = '/'.$cid; |
$scope = '/'.$cid; |
Line 134 sub modifyuserrole {
|
Line 134 sub modifyuserrole {
|
generation => $gene, |
generation => $gene, |
id => $uid, |
id => $uid, |
); |
); |
|
|
|
# When "Update ID in user's course(s)" and "Force change of existing ID" |
|
# checkboxes both checked, prevent replacement of name information |
|
# in classlist.db file(s) for the user's course(s) with blank(s), |
|
# in the case where the uploaded csv file was without column(s) for |
|
# the particular field. Fields are: First Name, Middle Names/Initials, |
|
# Last Name (or the composite: Last Name, First Names), and Generation. |
|
|
|
my %emptyallowed; |
|
if ((ref($emptyok) eq 'HASH') && (keys(%{$emptyok}) > 0)) { |
|
%emptyallowed = %{$emptyok}; |
|
} |
|
foreach my $field (keys(%userupdate)) { |
|
if ($userupdate{$field} eq '') { |
|
unless ($emptyallowed{$field}) { |
|
delete($userupdate{$field}); |
|
} |
|
} |
|
} |
$idresult = &propagate_id_change($uname,$udom,\%userupdate); |
$idresult = &propagate_id_change($uname,$udom,\%userupdate); |
} |
} |
} |
} |
Line 510 END
|
Line 529 END
|
"; |
"; |
} elsif ($mode eq 'modifycourse') { |
} elsif ($mode eq 'modifycourse') { |
$auth_checks .= " |
$auth_checks .= " |
if (vf.elements[current.argfield].value == null || vf.elements[current.argfield].value == '') { |
if ((current.argfield !== null) && (current.argfield !== undefined) && (current.argfield !== '') && (vf.elements[current.argfield].value == null || vf.elements[current.argfield].value == '')) { |
"; |
"; |
} |
} |
if ( ($mode eq 'createcourse') || ($mode eq 'modifycourse') ) { |
if ( ($mode eq 'createcourse') || ($mode eq 'modifycourse') ) { |
Line 543 END
|
Line 562 END
|
case 'krb': |
case 'krb': |
alertmsg = '$alert{'krb'}'; |
alertmsg = '$alert{'krb'}'; |
break; |
break; |
case 'loc': |
|
case 'int': |
case 'int': |
alertmsg = '$alert{'ipass'}'; |
alertmsg = '$alert{'ipass'}'; |
break; |
break; |
case 'fsys': |
case 'fsys': |
alertmsg = '$alert{'ipass'}'; |
alertmsg = '$alert{'ipass'}'; |
break; |
break; |
|
case 'loc': |
|
alertmsg = ''; |
|
break; |
default: |
default: |
alertmsg = ''; |
alertmsg = ''; |
} |
} |
Line 3661 END
|
Line 3682 END
|
setSections(formname,'$crstype'); |
setSections(formname,'$crstype'); |
if (seccheck == 'ok') { |
if (seccheck == 'ok') { |
opener.document.$callingform.newsecs.value = formname.sections.value; |
opener.document.$callingform.newsecs.value = formname.sections.value; |
|
} else { |
|
return; |
} |
} |
END |
END |
} else { |
} else { |
Line 4286 sub upfile_drop_add {
|
Line 4309 sub upfile_drop_add {
|
$fieldstype{$field.'_choice'} = 'scalar'; |
$fieldstype{$field.'_choice'} = 'scalar'; |
} |
} |
&Apache::loncommon::store_course_settings('enrollment_upload',\%fieldstype); |
&Apache::loncommon::store_course_settings('enrollment_upload',\%fieldstype); |
my ($cid,$crstype,$setting); |
my ($cid,$crstype,$setting,%emptyok); |
if ($context eq 'domain') { |
if ($context eq 'domain') { |
$setting = $env{'form.roleaction'}; |
$setting = $env{'form.roleaction'}; |
|
if (exists($fields{'names'})) { |
|
map { $emptyok{$_} = 1; } ('lastname','firstname','middlename'); |
|
} else { |
|
if (exists($fields{'lname'})) { |
|
$emptyok{'lastname'} = 1; |
|
} |
|
if (exists($fields{'fname'})) { |
|
$emptyok{'firstname'} = 1; |
|
} |
|
if (exists($fields{'mname'})) { |
|
$emptyok{'middlename'} = 1; |
|
} |
|
} |
|
if (exists($fields{'gen'})) { |
|
$emptyok{'generation'} = 1; |
|
} |
} |
} |
if ($env{'request.course.id'} ne '') { |
if ($env{'request.course.id'} ne '') { |
$cid = $env{'request.course.id'}; |
$cid = $env{'request.course.id'}; |
Line 4933 sub upfile_drop_add {
|
Line 4972 sub upfile_drop_add {
|
my (%userres,%authres,%roleres,%idres); |
my (%userres,%authres,%roleres,%idres); |
my $singlesec = ''; |
my $singlesec = ''; |
if ($role eq 'st') { |
if ($role eq 'st') { |
|
if (($context eq 'domain') && ($changeauth eq 'Yes') && (!$newuser)) { |
|
if ((&Apache::lonnet::allowed('mau',$userdomain)) && |
|
(&Apache::lonnet::homeserver($username,$userdomain) ne 'no_host')) { |
|
if ((($amode =~ /^krb4|krb5|internal$/) && $password ne '') || |
|
($amode eq 'localauth')) { |
|
$authresult = |
|
&Apache::lonnet::modifyuserauth($userdomain,$username,$amode,$password); |
|
} |
|
} |
|
} |
my $sec; |
my $sec; |
if (ref($userinfo{$i}{'sections'}) eq 'ARRAY') { |
if (ref($userinfo{$i}{'sections'}) eq 'ARRAY') { |
if (@secs > 0) { |
if (@secs > 0) { |
Line 4974 sub upfile_drop_add {
|
Line 5023 sub upfile_drop_add {
|
} |
} |
} |
} |
} |
} |
if (!$multiple) { |
} |
($userresult,$authresult,$roleresult,$idresult) = |
if (!$multiple) { |
&modifyuserrole($context,$setting, |
($userresult,$authresult,$roleresult,$idresult) = |
$changeauth,$cid,$userdomain,$username, |
&modifyuserrole($context,$setting, |
$id,$amode,$password,$fname, |
$changeauth,$cid,$userdomain,$username, |
$mname,$lname,$gen,$singlesec, |
$id,$amode,$password,$fname, |
$env{'form.forceid'},$desiredhost, |
$mname,$lname,$gen,$singlesec, |
$email,$role,$enddate,$startdate, |
$env{'form.forceid'},$desiredhost, |
$checkid,$inststatus); |
$email,$role,$enddate,$startdate, |
} |
$checkid,$inststatus,\%emptyok); |
} |
} |
} |
} |
if ($multiple) { |
if ($multiple) { |
Line 5103 sub passwdrule_alerts {
|
Line 5152 sub passwdrule_alerts {
|
my %passwdconf = &Apache::lonnet::get_passwdconf($domain); |
my %passwdconf = &Apache::lonnet::get_passwdconf($domain); |
$warning = '<b>'.&mt('Password requirement(s) unmet for one or more users:').'</b><ul>'; |
$warning = '<b>'.&mt('Password requirement(s) unmet for one or more users:').'</b><ul>'; |
if ($showrules{'min'}) { |
if ($showrules{'min'}) { |
$warning .= '<li>'.&mt('minimum [quant,_1,character]',$passwdconf{'min'}).'</li>'; |
my $min = $passwdconf{'min'}; |
|
if ($min eq '') { |
|
$min = $Apache::lonnet::passwdmin; |
|
} |
|
$warning .= '<li>'.&mt('minimum [quant,_1,character]',$min).'</li>'; |
} |
} |
if ($showrules{'max'}) { |
if ($showrules{'max'}) { |
$warning .= '<li>'.&mt('maximum [quant,_1,character]',$passwdconf{'max'}).'</li>'; |
$warning .= '<li>'.&mt('maximum [quant,_1,character]',$passwdconf{'max'}).'</li>'; |
Line 5995 sub can_modify_userinfo {
|
Line 6048 sub can_modify_userinfo {
|
return %canmodify; |
return %canmodify; |
} |
} |
|
|
|
sub can_change_internalpass { |
|
my ($uname,$udom,$crstype,$permission) = @_; |
|
my $canchange; |
|
if (&Apache::lonnet::allowed('mau',$udom)) { |
|
$canchange = 1; |
|
} elsif ((ref($permission) eq 'HASH') && ($permission->{'mip'}) && |
|
($udom eq $env{'request.role.domain'})) { |
|
unless ($env{'course.'.$env{'request.course.id'}.'.internal.nopasswdchg'}) { |
|
my ($cnum,$cdom) = &get_course_identity(); |
|
if ((&Apache::lonnet::is_course_owner($cdom,$cnum)) && ($udom eq $env{'user.domain'})) { |
|
my @userstatuses = ('default'); |
|
my %userenv = &Apache::lonnet::userenvironment($udom,$uname,'inststatus'); |
|
if ($userenv{'inststatus'} ne '') { |
|
@userstatuses = split(/:/,$userenv{'inststatus'}); |
|
} |
|
my $noupdate = 1; |
|
my %passwdconf = &Apache::lonnet::get_passwdconf($cdom); |
|
if (ref($passwdconf{'crsownerchg'}) eq 'HASH') { |
|
if (ref($passwdconf{'crsownerchg'}{'for'}) eq 'ARRAY') { |
|
foreach my $status (@userstatuses) { |
|
if (grep(/^\Q$status\E$/,@{$passwdconf{'crsownerchg'}{'for'}})) { |
|
undef($noupdate); |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
if ($noupdate) { |
|
return; |
|
} |
|
my %owned = &Apache::lonnet::courseiddump($cdom,'.',1,'.', |
|
$env{'user.name'}.':'.$env{'user.domain'}, |
|
undef,undef,undef,'.'); |
|
my %roleshash = &Apache::lonnet::get_my_roles($uname,$udom,'userroles', |
|
['active','future']); |
|
foreach my $key (keys(%roleshash)) { |
|
my ($name,$domain,$role) = split(/:/,$key); |
|
if ($role eq 'st') { |
|
next if (($name eq $cnum) && ($domain eq $cdom)); |
|
if ($owned{$domain.'_'.$name}) { |
|
if (ref($owned{$domain.'_'.$name}) eq 'HASH') { |
|
if ($owned{$domain.'_'.$name}{'nopasswdchg'}) { |
|
$noupdate = 1; |
|
last; |
|
} |
|
} |
|
} else { |
|
$noupdate = 1; |
|
last; |
|
} |
|
} else { |
|
$noupdate = 1; |
|
last; |
|
} |
|
} |
|
unless ($noupdate) { |
|
$canchange = 1; |
|
} |
|
} |
|
} |
|
} |
|
return $canchange; |
|
} |
|
|
sub check_usertype { |
sub check_usertype { |
my ($dom,$uname,$rules,$curr_rules,$got_rules) = @_; |
my ($dom,$uname,$rules,$curr_rules,$got_rules) = @_; |
my $usertype; |
my $usertype; |
Line 6115 sub get_permission {
|
Line 6232 sub get_permission {
|
$permission{'selfenrolladmin'} = 1; |
$permission{'selfenrolladmin'} = 1; |
} |
} |
} |
} |
|
unless ($permission{'selfenrolladmin'}) { |
|
$permission{'selfenrollview'} = 1; |
|
} |
} |
} |
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
my $user = $env{'user.name'}.':'.$env{'user.domain'}; |
my $user; |
|
if (($env{'user.name'} ne '') && ($env{'user.domain'} ne '')) { |
|
$user = $env{'user.name'}.':'.$env{'user.domain'}; |
|
} |
if (($user ne '') && ($env{'course.'.$env{'request.course.id'}.'.internal.courseowner'} eq |
if (($user ne '') && ($env{'course.'.$env{'request.course.id'}.'.internal.courseowner'} eq |
$user)) { |
$user)) { |
$permission{'owner'} = 1; |
$permission{'owner'} = 1; |
|
if (&Apache::lonnet::allowed('mip',$env{'request.course.id'})) { |
|
$permission{'mip'} = 1; |
|
} |
} elsif (($user ne '') && ($env{'course.'.$env{'request.course.id'}.'.internal.co-owners'} ne '')) { |
} elsif (($user ne '') && ($env{'course.'.$env{'request.course.id'}.'.internal.co-owners'} ne '')) { |
if (grep(/^\Q$user\E$/,split(/,/,$env{'course.'.$env{'request.course.id'}.'.internal.co-owners'}))) { |
if (grep(/^\Q$user\E$/,split(/,/,$env{'course.'.$env{'request.course.id'}.'.internal.co-owners'}))) { |
$permission{'co-owner'} = 1; |
$permission{'co-owner'} = 1; |
Line 6571 sub selfenrollment_administration {
|
Line 6697 sub selfenrollment_administration {
|
} |
} |
} |
} |
if ($settings{'internal.selfenrollmgrdc'} ne '') { |
if ($settings{'internal.selfenrollmgrdc'} ne '') { |
my @in_domain = split(/,/,$settings{'internal.selfenrollmgrdc'}); |
@in_domain = split(/,/,$settings{'internal.selfenrollmgrdc'}); |
my @diffs = &Apache::loncommon::compare_arrays(\@in_domain,$possconfigs); |
my @diffs = &Apache::loncommon::compare_arrays(\@in_domain,$possconfigs); |
unless (@diffs) { |
unless (@diffs) { |
return (\@in_course,\@in_domain); |
return (\@in_course,\@in_domain); |