[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 22 Jun 2006 15:34:16 -0000
albertel Thu Jun 22 11:34:16 2006 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
Log:
- access controls no longer need parsing
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.756 loncom/lonnet/perl/lonnet.pm:1.757
--- loncom/lonnet/perl/lonnet.pm:1.756 Thu Jun 22 10:48:40 2006
+++ loncom/lonnet/perl/lonnet.pm Thu Jun 22 11:34:16 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.756 2006/06/22 14:48:40 albertel Exp $
+# $Id: lonnet.pm,v 1.757 2006/06/22 15:34:16 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4706,67 +4706,6 @@
return %access;
}
-sub parse_access_controls {
- my ($access_item) = @_;
- my %content;
- my $role_id;
- my $user;
- my $usercount;
- my $token;
- my $parser=HTML::TokeParser->new(\$access_item);
- while ($token=$parser->get_token) {
- if ($token->[0] eq 'S') {
- my $entry=$token->[1];
- if ($entry eq 'scope') {
- my $type = $token->[2]{'type'};
- if (($type eq 'course') || ($type eq 'group')) {
- $content{'roles'} = {};
- }
- } elsif ($entry eq 'roles') {
- $role_id = $token->[2]{id};
- $content{$entry}{$role_id} = {
- role => [],
- access => [],
- section => [],
- group => [],
- };
- } elsif ($entry eq 'users') {
- $content{'users'} = {};
- $usercount = 0;
- } elsif ($entry eq 'user') {
- $user = '';
- } else {
- my $value=$parser->get_text('/'.$entry);
- if ($entry eq 'uname') {
- $user = $value;
- } elsif ($entry eq 'udom') {
- $user .= ':'.$value;
- $content{'users'}{$user} = $usercount;
- } elsif ($entry eq 'role' ||
- $entry eq 'access' ||
- $entry eq 'section' ||
- $entry eq 'group') {
- if ($role_id ne '') {
- push(@{$content{'roles'}{$role_id}{$entry}},$value);
- }
- } elsif ($entry eq 'dom') {
- push(@{$content{$entry}},$value);
- } else {
- $content{$entry}=$value;
- }
- }
- } elsif ($token->[0] eq 'E') {
- if ($token->[1] eq 'user') {
- $user = '';
- $usercount ++;
- } elsif ($token->[1] eq 'roles') {
- $role_id = '';
- }
- }
- }
- return %content;
-}
-
sub modify_access_controls {
my ($file_name,$changes,$domain,$user)=@_;
my ($outcome,$deloutcome);