[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 02 Jun 2006 21:32:30 -0000
albertel Fri Jun 2 17:32:30 2006 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
Log:
- switching to passing around hashes rather than long opaque strings
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.742 loncom/lonnet/perl/lonnet.pm:1.743
--- loncom/lonnet/perl/lonnet.pm:1.742 Fri Jun 2 09:58:58 2006
+++ loncom/lonnet/perl/lonnet.pm Fri Jun 2 17:32:30 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.742 2006/06/02 13:58:58 raeburn Exp $
+# $Id: lonnet.pm,v 1.743 2006/06/02 21:32:30 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2716,7 +2716,7 @@
my %allroles=();
my %allgroups=();
my $now=time;
- my $userroles="user.login.time=$now\n";
+ my %userroles = ('user.login.time' => $now);
my $group_privs;
if ($rolesdump ne '') {
@@ -2739,7 +2739,9 @@
} else {
($trole,$tend,$tstart)=split(/_/,$role);
}
- $userroles.=&set_arearole($trole,$area,$tstart,$tend,$domain,$username);
+ my %new_role = &set_arearole($trole,$area,$tstart,$tend,$domain,
+ $username);
+ @userroles{keys(%new_role)} = @new_role{keys(%new_role)};
if (($tend!=0) && ($tend<$now)) { $trole=''; }
if (($tstart!=0) && ($tstart>$now)) { $trole=''; }
if (($area ne '') && ($trole ne '')) {
@@ -2755,19 +2757,19 @@
}
}
}
- my ($author,$adv) = &set_userprivs(\$userroles,\%allroles,\%allgroups);
- $userroles.='user.adv='.$adv."\n".
- 'user.author='.$author."\n";
+ my ($author,$adv) = &set_userprivs(\%userroles,\%allroles,\%allgroups);
+ $userroles{'user.adv'} = $adv;
+ $userroles{'user.author'} = $author;
$env{'user.adv'}=$adv;
}
- return $userroles;
+ return \%userroles;
}
sub set_arearole {
my ($trole,$area,$tstart,$tend,$domain,$username) = @_;
# log the associated role with the area
&userrolelog($trole,$username,$domain,$area,$tstart,$tend);
- return 'user.role.'.$trole.'.'.$area.'='.$tstart.'.'.$tend."\n";
+ return ('user.role.'.$trole.'.'.$area => $tstart.'.'.$tend);
}
sub custom_roleprivs {
@@ -2869,7 +2871,7 @@
}
my $thesestr='';
foreach (keys %thesepriv) { $thesestr.=':'.$_.'&'.$thesepriv{$_}; }
- $$userroles.='user.priv.'.$_.'='.$thesestr."\n";
+ $userroles->{'user.priv.'.$_} = $thesestr;
}
return ($author,$adv);
}