[LON-CAPA-cvs] cvs: loncom /auth lonacc.pm lonauth.pm /interface lonmenu.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 05 Jul 2005 21:30:17 -0000
albertel Tue Jul 5 17:30:17 2005 EDT
Modified files:
/loncom/auth lonacc.pm lonauth.pm
/loncom/interface lonmenu.pm
Log:
- BUG#2573 can't do randomlabel/imageresponse/reactionresponse/organicresponse etc as 'public' resources,
- public users on first access get a Cookie and a skeleton of a session environment now
Index: loncom/auth/lonacc.pm
diff -u loncom/auth/lonacc.pm:1.65 loncom/auth/lonacc.pm:1.66
--- loncom/auth/lonacc.pm:1.65 Fri Apr 22 16:55:40 2005
+++ loncom/auth/lonacc.pm Tue Jul 5 17:30:14 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Cookie Based Access Handler
#
-# $Id: lonacc.pm,v 1.65 2005/04/22 20:55:40 albertel Exp $
+# $Id: lonacc.pm,v 1.66 2005/07/05 21:30:14 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -159,21 +159,16 @@
if ($requrl=~m|^/public/|
|| (&Apache::lonnet::metadata($requrl,'copyright') eq 'public')) {
&Apache::lonnet::logthis('Granting public access: '.$requrl);
+ my $cookie=
+ &Apache::lonauth::success($r,'public','public','public');
+ my $lonidsdir=$r->dir_config('lonIDsDir');
+ &Apache::lonnet::transfer_profile_to_env($lonidsdir,$cookie);
&Apache::loncommon::get_posted_cgi($r);
- $env{'user.name'}='public';
- $env{'user.domain'}='public';
$env{'request.state'} = "published";
$env{'request.publicaccess'} = 1;
$env{'request.filename'} = $r->filename;
- my ($httpbrowser, $clientbrowser, $clientversion,
- $clientmathml, $clientunicode, $clientos) =
- &Apache::loncommon::decode_user_agent($r);
- $env{'browser.type'}=$clientbrowser;
- $env{'browser.version'}=$clientversion;
- $env{'browser.mathml'}=$clientmathml;
- $env{'browser.unicode'}=$clientunicode;
- $env{'browser.os'}=$clientos;
+ $r->header_out('Set-cookie',"lonID=$cookie; path=/");
return OK;
}
# -------------------------------------------------------------- Not authorized
Index: loncom/auth/lonauth.pm
diff -u loncom/auth/lonauth.pm:1.67 loncom/auth/lonauth.pm:1.68
--- loncom/auth/lonauth.pm:1.67 Mon Jun 6 22:14:28 2005
+++ loncom/auth/lonauth.pm Tue Jul 5 17:30:14 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# User Authentication Module
#
-# $Id: lonauth.pm,v 1.67 2005/06/07 02:14:28 www Exp $
+# $Id: lonauth.pm,v 1.68 2005/07/05 21:30:14 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -138,6 +138,9 @@
print $idf "request.role=cm\n";
print $idf "request.role.adv=$env{'user.adv'}\n";
print $idf "request.host=$ENV{'REMOTE_ADDR'}\n";
+ if ($username eq 'public' && $domain eq 'public') {
+ print $idf "environment.remote=off\n";
+ }
if ($FORM{'interface'}) {
$FORM{'interface'}=~s/\W//gs;
print $idf "browser.interface=$FORM{'interface'}\n";
@@ -172,6 +175,9 @@
# ------------------------------------------------------------ Get cookie ready
+ if ($username eq 'public' && $domain eq 'public') {
+ return $cookie;
+ }
$cookie="lonID=$cookie; path=/";
# -------------------------------------------------------- Menu script and info
my $windowinfo=&Apache::lonmenu::open($clientos);
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.155 loncom/interface/lonmenu.pm:1.156
--- loncom/interface/lonmenu.pm:1.155 Tue Jun 7 22:27:21 2005
+++ loncom/interface/lonmenu.pm Tue Jul 5 17:30:14 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.155 2005/06/08 02:27:21 www Exp $
+# $Id: lonmenu.pm,v 1.156 2005/07/05 21:30:14 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -157,6 +157,24 @@
my $alink=&Apache::loncommon::designparm($function.'.alink',$domain);
my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain);
my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain);
+ if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {
+ my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");
+ return (<<ENDINLINEMENU);
+<font face="Arial,Helvetica,sans-serif">
+ <table bgcolor="$pgbg" width="100%" border="0" cellpadding="1" cellspacing="1">
+ <tr>
+ <td bgcolor="$tabbg">
+ <a href="/adm/logout" target="_top"><font color="$font">$lt{'exit'}</font></a>
+ </td>
+ <td align="right" bgcolor="$tabbg">
+ <img align="right" src="$logo" />
+ <b>LON-CAPA</b>
+ </td>
+ </tr>
+ </table>
+</font>
+ENDINLINEMENU
+ }
# Do we have a NAV link?
if ($env{'request.course.id'}) {
my $link='/adm/navmaps?postdata='.$escurl.'&postsymb='.