[LON-CAPA-cvs] cvs: loncom / lonenc.pm

foxr lon-capa-cvs-allow@mail.lon-capa.org
Mon, 17 Mar 2008 09:51:41 -0000


foxr		Mon Mar 17 05:51:41 2008 EDT

  Modified files:              
    /loncom	lonenc.pm 
  Log:
  Added reset_enc function for modules that need to reset the
  state of the encoding env var.
  
  
Index: loncom/lonenc.pm
diff -u loncom/lonenc.pm:1.22 loncom/lonenc.pm:1.23
--- loncom/lonenc.pm:1.22	Fri Oct  5 14:33:29 2007
+++ loncom/lonenc.pm	Mon Mar 17 05:51:40 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # URL translation for encrypted filenames
 #
-# $Id: lonenc.pm,v 1.22 2007/10/05 18:33:29 albertel Exp $
+# $Id: lonenc.pm,v 1.23 2008/03/17 09:51:40 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -34,6 +34,17 @@
 use Time::HiRes qw(gettimeofday);
 use LONCAPA;
  
+
+#
+#  If a module makes multiple SSI calls and some of the ssi calls result in a
+#  resource for an encoded URL, and this can be done in an unprivileged role,
+#  there must be a mechanism t oreset the 'request.enc' environment variable.
+#  This sub centralizes that mechanism:
+#
+sub reset_enc {
+    $env{'request.enc'} = 0;
+}
+
 sub encryptseed {
     my ($cid) = @_;
     if (!defined($cid)) {