[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Wed, 04 Apr 2007 18:01:19 -0000


raeburn		Wed Apr  4 14:01:19 2007 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Conditional access controls for users are stored in an array of hashes (not a plain hash) within the $access{$key}{'users'} hash. 
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.864 loncom/lonnet/perl/lonnet.pm:1.865
--- loncom/lonnet/perl/lonnet.pm:1.864	Tue Apr  3 20:48:23 2007
+++ loncom/lonnet/perl/lonnet.pm	Wed Apr  4 14:01:11 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.864 2007/04/04 00:48:23 albertel Exp $
+# $Id: lonnet.pm,v 1.865 2007/04/04 18:01:11 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3586,9 +3586,16 @@
             }
             if (@users > 0) {
                 foreach my $userkey (@users) {
-                    if (exists($access_hash->{$userkey}{'users'}{$env{'user.name'}.':'.$env{'user.domain'}})) {
-                        return 'ok';
-                    }
+                    if (ref($access_hash->{$userkey}{'users'}) eq 'ARRAY') {
+                        foreach my $item (@{$access_hash->{$userkey}{'users'}}) {
+                            if (ref($item) eq 'HASH') {
+                                if (($item->{'uname'} eq $env{'user.name'}) &&
+                                    ($item->{'udom'} eq $env{'user.domain'})) {
+                                    return 'ok';
+                                }
+                            }
+                        }
+                    } 
                 }
             }
             my %roleshash;