[LON-CAPA-cvs] cvs: rat / lonuserstate.pm loncom/auth lonroles.pm
raeburn
raeburn at source.lon-capa.org
Mon Apr 19 16:09:07 EDT 2021
raeburn Mon Apr 19 20:09:07 2021 EDT
Modified files:
/loncom/auth lonroles.pm
/rat lonuserstate.pm
Log:
- Only check for critical messages initializing course session, when
readmap() is called from roles screen, and critical alerts are *not*
blocked for selected course.
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.345 loncom/auth/lonroles.pm:1.346
--- loncom/auth/lonroles.pm:1.345 Mon Apr 19 15:05:55 2021
+++ loncom/auth/lonroles.pm Mon Apr 19 20:09:07 2021
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.345 2021/04/19 15:05:55 raeburn Exp $
+# $Id: lonroles.pm,v 1.346 2021/04/19 20:09:07 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -591,9 +591,21 @@
}
}
}
- my $msg;
+ my ($msg,$blockcrit,$critmsg_check);
+ $critmsg_check = 1;
+ $blockcrit = &Apache::loncommon::blocking_status('alert',$cnum,$cdom,undef,1);
+ if ($blockcrit) {
+ my $checkrole = "cm./$cdom/$cnum";
+ if ($csec ne '') {
+ $checkrole .= "/$csec";
+ }
+ unless ((&Apache::lonnet::allowed('evb',undef,undef,$checkrole)) &&
+ ($trolecode !~ m{^st\./$cdom/$cnum})) {
+ $critmsg_check = 0;
+ }
+ }
my ($furl,$ferr)=
- &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
+ &Apache::lonuserstate::readmap($cdom.'/'.$cnum,$critmsg_check);
unless ($ferr) {
&Apache::lonnet::appenv({'request.course.timechecked'=>$now});
unless (($env{'form.switchrole'}) ||
Index: rat/lonuserstate.pm
diff -u rat/lonuserstate.pm:1.160 rat/lonuserstate.pm:1.161
--- rat/lonuserstate.pm:1.160 Wed Apr 22 15:24:07 2020
+++ rat/lonuserstate.pm Mon Apr 19 20:09:07 2021
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Construct and maintain state and binary representation of course for user
#
-# $Id: lonuserstate.pm,v 1.160 2020/04/22 15:24:07 raeburn Exp $
+# $Id: lonuserstate.pm,v 1.161 2021/04/19 20:09:07 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1211,7 +1211,7 @@
# ---------------------------------------------------- Read map and all submaps
sub readmap {
- my $short=shift;
+ my ($short,$critmsg_check) = @_;
$short=~s/^\///;
# TODO: Hidden dependency on current user:
@@ -1450,13 +1450,17 @@
# Depends on user must parameterize this as well..or separate as this is:
# more part of determining what someone sees on entering a course?
+# When lonuserstate::readmap() is called from lonroles.pm, i.e.,
+# after selecting a role in a course, critical_redirect will be called,
+# unless the course has a blocking event in effect, when suppresses
+# critical message checking (users without evb priv).
+#
- my @what=&Apache::lonnet::dump('critical',$env{'user.domain'},
- $env{'user.name'});
- if ($what[0]) {
- if (($what[0] ne 'con_lost') && ($what[0]!~/^error\:/)) {
- $retfurl='/adm/email?critical=display';
- }
+ if ($critmsg_check) {
+ my ($redirect,$url) = &Apache::loncommon::critical_redirect();
+ if ($redirect) {
+ $retfurl = $url;
+ }
}
return ($retfurl,$errtext);
}
More information about the LON-CAPA-cvs
mailing list