--- loncom/lonnet/perl/lonnet.pm 2019/04/29 22:19:45 1.1409 +++ loncom/lonnet/perl/lonnet.pm 2019/07/18 18:28:58 1.1411 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.1409 2019/04/29 22:19:45 raeburn Exp $ +# $Id: lonnet.pm,v 1.1411 2019/07/18 18:28:58 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1082,6 +1082,19 @@ sub find_existing_session { return; } +sub delusersession { + my ($lonid,$udom,$uname) = @_; + my $uprimary_id = &domain($udom,'primary'); + my $uintdom = &internet_dom($uprimary_id); + my $intdom = &internet_dom($lonid); + my $serverhomedom = &host_domain($lonid); + if (($uintdom ne '') && ($uintdom eq $intdom)) { + return &reply(join(':','delusersession', + map {&escape($_)} ($udom,$uname)),$lonid); + } + return; +} + # check if user's browser sent load balancer cookie and server still has session # and is not overloaded. sub check_for_balancer_cookie { @@ -8089,9 +8102,21 @@ sub allowed { ($env{'course.'.$env{'request.course.id'}.'.internal.courseowner'} eq $env{'user.name'}.':'.$env{'user.domain'})) { my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; if ($cdom ne '') { - my %passwdconf = &Apache::lonnet::get_passwdconf($cdom); - if ($passwdconf{'crsownerchg'}) { - $thisallowed.=$rem; + my %passwdconf = &get_passwdconf($cdom); + if (ref($passwdconf{'crsownerchg'}) eq 'HASH') { + if (ref($passwdconf{'crsownerchg'}{'by'}) eq 'ARRAY') { + if (@{$passwdconf{'crsownerchg'}{'by'}}) { + my @inststatuses = split(':',$env{'environment.inststatus'}); + unless (@inststatuses) { + @inststatuses = ('default'); + } + foreach my $status (@inststatuses) { + if (grep(/^\Q$status\E$/,@{$passwdconf{'crsownerchg'}{'by'}})) { + $thisallowed.=$rem; + } + } + } + } } } }