[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm /interface lonmanagekeys.pm /lonnet/perl lonnet.pm
www
lon-capa-cvs@mail.lon-capa.org
Sun, 09 May 2004 00:45:01 -0000
www Sat May 8 20:45:01 2004 EDT
Modified files:
/loncom/auth lonroles.pm
/loncom/interface lonmanagekeys.pm
/loncom/lonnet/perl lonnet.pm
Log:
Bug #2970: Key authority other than course possible
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.90 loncom/auth/lonroles.pm:1.91
--- loncom/auth/lonroles.pm:1.90 Sat May 8 12:26:32 2004
+++ loncom/auth/lonroles.pm Sat May 8 20:45:00 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.90 2004/05/08 16:26:32 www Exp $
+# $Id: lonroles.pm,v 1.91 2004/05/09 00:45:00 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -135,6 +135,7 @@
&Apache::lonnet::assign_access_key(
$ENV{'form.newkey'},
$authdom,$authnum,
+ $cdom,$cnum,
$ENV{'user.domain'},
$ENV{'user.name'},
'Assigned from '.$ENV{'REMOTE_ADDR'}.' at '.localtime().' for '.
Index: loncom/interface/lonmanagekeys.pm
diff -u loncom/interface/lonmanagekeys.pm:1.14 loncom/interface/lonmanagekeys.pm:1.15
--- loncom/interface/lonmanagekeys.pm:1.14 Fri May 7 22:07:16 2004
+++ loncom/interface/lonmanagekeys.pm Sat May 8 20:45:01 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to manage course access keys
#
-# $Id: lonmanagekeys.pm,v 1.14 2004/05/08 02:07:16 www Exp $
+# $Id: lonmanagekeys.pm,v 1.15 2004/05/09 00:45:01 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -194,7 +194,7 @@
my %cenv=&Apache::lonnet::coursedescription($ENV{'form.cid'});
my $keytype='';
if ($cenv{'url'} eq '/res/') {
- ($cenv{'num'},$cenv{'domain'})=split(/\_/,$ENV{'form.cid'});
+ ($cenv{'domain'},$cenv{'num'})=split(/\_/,$ENV{'form.cid'});
$keytype='auth';
} elsif ($cenv{'keyauth'}) {
($cenv{'num'},$cenv{'domain'})=split(/\W/,$cenv{'keyauth'});
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.497 loncom/lonnet/perl/lonnet.pm:1.498
--- loncom/lonnet/perl/lonnet.pm:1.497 Sat May 8 19:55:34 2004
+++ loncom/lonnet/perl/lonnet.pm Sat May 8 20:45:01 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.497 2004/05/08 23:55:34 www Exp $
+# $Id: lonnet.pm,v 1.498 2004/05/09 00:45:01 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -642,14 +642,18 @@
# a valid key looks like uname:udom#comments
# comments are being appended
#
- my ($ckey,$cdom,$cnum,$udom,$uname,$logentry)=@_;
+ my ($ckey,$kdom,$knum,$cdom,$cnum,$udom,$uname,$logentry)=@_;
+ $kdom=
+ $ENV{'course.'.$ENV{'request.course.id'}.'.domain'} unless (defined($kdom));
+ $knum=
+ $ENV{'course.'.$ENV{'request.course.id'}.'.num'} unless (defined($knum));
$cdom=
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'} unless (defined($cdom));
$cnum=
$ENV{'course.'.$ENV{'request.course.id'}.'.num'} unless (defined($cnum));
$udom=$ENV{'user.name'} unless (defined($udom));
$uname=$ENV{'user.domain'} unless (defined($uname));
- my %existing=&get('accesskeys',[$ckey],$cdom,$cnum);
+ my %existing=&get('accesskeys',[$ckey],$kdom,$knum);
if (($existing{$ckey}=~/^\#(.*)$/) || # - new key
($existing{$ckey}=~/^\Q$uname\E\:\Q$udom\E\#(.*)$/)) {
# assigned to this person
@@ -659,7 +663,7 @@
# ready to assign
$logentry=$1.'; '.$logentry;
if (&put('accesskeys',{$ckey=>$uname.':'.$udom.'#'.$logentry},
- $cdom,$cnum) eq 'ok') {
+ $kdom,$knum) eq 'ok') {
# key now belongs to user
my $envkey='key.'.$cdom.'_'.$cnum;
if (&put('environment',{$envkey => $ckey}) eq 'ok') {