--- loncom/auth/lonroles.pm 2008/05/14 19:18:37 1.189
+++ loncom/auth/lonroles.pm 2008/05/14 23:52:52 1.191
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.189 2008/05/14 19:18:37 www Exp $
+# $Id: lonroles.pm,v 1.191 2008/05/14 23:52:52 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -138,7 +138,17 @@ sub handler {
if (my ($domain,$coursenum) =
($envkey =~ m-^form\.cc\./($match_domain)/($match_courseid)$-)) {
# See if that is even allowed
-
+ my %crsenv=&Apache::lonnet::get('environment',['internal.courseowner'],$domain,$coursenum);
+ # First find course owner
+ my ($owneruser,$ownerdomain)=split(/\:/,$crsenv{'internal.courseowner'});
+ # Check if course owner blocked cc-access
+ if (($owneruser) && ($ownerdomain)) {
+ my %blocked=&Apache::lonnet::get('environment',['domcoord.cc'],$ownerdomain,$owneruser);
+ if ($blocked{'domcoord.cc'} eq 'blocked') {
+ $env{'user.error.msg'}=':::1:Course owner '.$owneruser.' in domain '.$ownerdomain.' blocked domain coordinator access';
+ last;
+ }
+ }
if ($dcroles{$domain}) {
&check_privs($domain,$coursenum,$then,$now,'cc');
}
@@ -147,6 +157,13 @@ sub handler {
# Is this a recent ad-hoc CA-role?
if (my ($domain,$user) =
($envkey =~ m-^form\.ca\./($match_domain)/($match_username)$-)) {
+ # See if still allowed
+ my %blocked=&Apache::lonnet::get('environment',['domcoord.author'],$domain,$user);
+ if ($blocked{'domcoord.author'} eq 'blocked') {
+ delete($env{$envkey});
+ $env{'user.error.msg'}=':::1:User '.$user.' in domain '.$domain.' blocked domain coordinator access';
+ last;
+ }
if (($dcroles{$domain}) && (&is_author_homeserver($user,$domain))) {
&check_privs($domain,$user,$then,$now,'ca');
} else {
@@ -513,8 +530,12 @@ ENDHEADER
my (%roletext,%sortrole,%roleclass);
my $countactive=0;
+ my $countfuture=0;
+ my $countwill=0;
my $inrole=0;
my $possiblerole='';
+ my %futureroles;
+ my %roles_nextlogin;
foreach $envkey (sort keys %env) {
my $button = 1;
my $switchserver='';
@@ -551,9 +572,13 @@ ENDHEADER
} elsif ($tstatus eq 'future') {
$tbg='#FFFF77';
$button=0;
+ $futureroles{$trolecode} = $tstart.':'.$tend;
+ $countfuture ++;
} elsif ($tstatus eq 'will') {
$tbg='#FFAA77';
$tremark.=&mt('Active at next login. ');
+ $roles_nextlogin{$trolecode} = $tstart.':'.$tend;
+ $countwill ++;
} elsif ($tstatus eq 'expired') {
$tbg='#FF7777';
$tfont='#330000';
@@ -676,7 +701,30 @@ ENDHEADER
} else {
$r->print('
'.&mt('Currently no active roles or courses').'
');
}
- $r->print(''.&Apache::loncommon::end_page());
+ &findcourse_advice($r);
+ $r->print('');
+ if ($countfuture) {
+ $r->print(&mt('The following [quant,_1,role,roles] will become active in the future:',$countfuture));
+ my $doheaders = &roletable_headers($r,\%roleclass,\%sortrole,
+ $nochoose);
+ &print_rolerows($r,$doheaders,\%roleclass,\%sortrole,\%dcroles,
+ \%roletext);
+ my $tremark='';
+ my $tfont='#003300';
+ if ($env{'request.role'} eq 'cm') {
+ $r->print('');
+ $tremark=&mt('Currently selected. ');
+ $tfont='#002200';
+ } else {
+ $r->print('
');
+ }
+ $r->print(' | '.&mt('No role specified').
+ ' | '.$tremark.
+ ' |
'."\n");
+
+ $r->print('');
+ }
+ $r->print(&Apache::loncommon::end_page());
return OK;
# Is there only one choice?
} elsif (($countactive==1) && ($env{'request.role'} eq 'cm')) {
@@ -694,21 +742,7 @@ ENDHEADER
unless ((!&Apache::lonmenu::show_course()) || ($nochoose)) {
$r->print("".&mt('Select a Course to Enter')."
\n");
}
- $r->print('