version 1.184.4.4, 2019/08/22 19:31:20
|
version 1.184.4.7, 2019/09/11 14:39:44
|
Line 655 sub passwd_validation_js {
|
Line 655 sub passwd_validation_js {
|
my %passwdconf = &Apache::lonnet::get_passwdconf($domain); |
my %passwdconf = &Apache::lonnet::get_passwdconf($domain); |
my ($min,$max,@chars,$numrules,$intargjs,%alert); |
my ($min,$max,@chars,$numrules,$intargjs,%alert); |
$numrules = 0; |
$numrules = 0; |
|
$min = $Apache::lonnet::passwdmin; |
if (ref($passwdconf{'chars'}) eq 'ARRAY') { |
if (ref($passwdconf{'chars'}) eq 'ARRAY') { |
if ($passwdconf{'min'} =~ /^\d+$/) { |
if ($passwdconf{'min'} =~ /^\d+$/) { |
$min = $passwdconf{'min'}; |
if ($passwdconf{'min'} > $min) { |
$numrules ++; |
$min = $passwdconf{'min'}; |
|
} |
} |
} |
if ($passwdconf{'max'} =~ /^\d+$/) { |
if ($passwdconf{'max'} =~ /^\d+$/) { |
$max = $passwdconf{'max'}; |
$max = $passwdconf{'max'}; |
Line 668 sub passwd_validation_js {
|
Line 670 sub passwd_validation_js {
|
if (@chars) { |
if (@chars) { |
$numrules ++; |
$numrules ++; |
} |
} |
} else { |
} |
$min = 7; |
if ($min > 0) { |
$numrules ++; |
$numrules ++; |
} |
} |
if (($min ne '') || ($max ne '') || (@chars > 0)) { |
if (($min > 0) || ($max ne '') || (@chars > 0)) { |
my $alertmsg = &mt('Initial password did not satisfy requirement(s):').'\n\n'; |
my $alertmsg = &mt('Initial password did not satisfy requirement(s):').'\n\n'; |
if ($min) { |
if ($min) { |
$alert{'min'} = &mt('minimum [quant,_1,character]',$min).'\n'; |
$alert{'min'} = &mt('minimum [quant,_1,character]',$min).'\n'; |
Line 4972 sub upfile_drop_add {
|
Line 4974 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); |
} |
} |
} |
} |
if ($multiple) { |
if ($multiple) { |
Line 5993 sub can_modify_userinfo {
|
Line 5995 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 6181 sub get_permission {
|
} |
} |
} |
} |
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; |