--- loncom/lonnet/perl/lonnet.pm 2021/05/04 18:47:38 1.1451 +++ loncom/lonnet/perl/lonnet.pm 2021/05/10 18:13:50 1.1453 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.1451 2021/05/04 18:47:38 raeburn Exp $ +# $Id: lonnet.pm,v 1.1453 2021/05/10 18:13:50 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -8242,8 +8242,8 @@ sub allowed { my $adom = $1; foreach my $key (keys(%env)) { if ($key =~ m{^user\.role\.(ca|aa)/\Q$adom\E}) { - my ($start,$end) = split('.',$env{$key}); - if (($now >= $start) && (!$end || $end < $now)) { + my ($start,$end) = split(/\./,$env{$key}); + if (($now >= $start) && (!$end || $end > $now)) { $ownaccess = 1; last; } @@ -8255,8 +8255,8 @@ sub allowed { foreach my $role ('ca','aa') { if ($env{"user.role.$role./$adom/$aname"}) { my ($start,$end) = - split('.',$env{"user.role.$role./$adom/$aname"}); - if (($now >= $start) && (!$end || $end < $now)) { + split(/\./,$env{"user.role.$role./$adom/$aname"}); + if (($now >= $start) && (!$end || $end > $now)) { $ownaccess = 1; last; } @@ -8533,13 +8533,17 @@ sub allowed { # Locks might take effect only after 10 minutes cache expiration for other # courses, and 2 minutes for current course - my $envkey; if ($thisallowed=~/L/) { - foreach $envkey (keys(%env)) { + my $now = time; + foreach my $envkey (keys(%env)) { if ($envkey=~/^user\.role\.(st|ta)\.([^\.]*)/) { my $courseid=$2; my $roleid=$1.'.'.$2; $courseid=~s/^\///; + unless ($env{'request.role'} eq $roleid) { + my ($start,$end) = split(/\./,$env{$envkey}); + next unless (($now >= $start) && (!$end || $end > $now)); + } my $expiretime=600; if ($env{'request.role'} eq $roleid) { $expiretime=120;