[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm

www lon-capa-cvs-allow@mail.lon-capa.org
Wed, 14 May 2008 19:18:37 -0000


www		Wed May 14 15:18:37 2008 EDT

  Modified files:              
    /loncom/auth	lonroles.pm 
  Log:
  More work on 5613
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.188 loncom/auth/lonroles.pm:1.189
--- loncom/auth/lonroles.pm:1.188	Mon May 12 19:47:37 2008
+++ loncom/auth/lonroles.pm	Wed May 14 15:18:37 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.188 2008/05/12 23:47:37 www Exp $
+# $Id: lonroles.pm,v 1.189 2008/05/14 19:18:37 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -137,6 +137,8 @@
 # Is this an ad-hoc CC-role?
                 if (my ($domain,$coursenum) =
 		    ($envkey =~ m-^form\.cc\./($match_domain)/($match_courseid)$-)) {
+                   # See if that is even allowed
+                    
                     if ($dcroles{$domain}) {
                         &check_privs($domain,$coursenum,$then,$now,'cc');
                     }
@@ -155,9 +157,15 @@
 # Is this a new ad-hoc CA-role?
                 if (my ($domain) =
                     ($envkey =~ m-^form\.adhocca\./($match_domain)$-)) {
+                    my $user=$env{'form.adhoccauname.'.$domain};
+                    if (!$user) { $user=$env{'form.adhoccaunamerecent.'.$domain} };
+                   # See if that is even allowed
+                    my %blocked=&Apache::lonnet::get('environment',['domcoord.author'],$domain,$user);
+                    if ($blocked{'domcoord.author'} eq 'blocked') {
+                       $env{'user.error.msg'}=':::1:User '.$user.' in domain '.$domain.' blocked domain coordinator access';
+                       last;
+                    }
                     if ($dcroles{$domain}) {
-                        my $user=$env{'form.adhoccauname.'.$domain};
-                        if (!$user) { $user=$env{'form.adhoccaunamerecent.'.$domain} };
                         if (($user) && ($user=~/$match_username/) && (&is_author_homeserver($user,$domain))) { 
                            &check_privs($domain,$user,$then,$now,'ca');
                            $env{'form.ca./'.$domain.'/'.$user}=1;