From db97a797521cd9063338184700730fe4035c1630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Oudot?= Date: Wed, 16 Mar 2011 13:58:17 +0000 Subject: [PATCH] Refresh portal object in Safe (#284) --- .../lib/Lemonldap/NG/Portal/Simple.pm | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm index 968dfe7b0..9d316178e 100644 --- a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm +++ b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm @@ -16,7 +16,7 @@ use MIME::Base64; use Lemonldap::NG::Common::CGI; use CGI::Cookie; require POSIX; -use Lemonldap::NG::Portal::_i18n; #inherits +use Lemonldap::NG::Portal::_i18n; #inherits use Lemonldap::NG::Common::Apache::Session ; #link protected session Apache::Session object use Lemonldap::NG::Common::Safe; #link protected safe Safe object @@ -63,7 +63,7 @@ use Digest::MD5; #inherits Apache::Session #link Lemonldap::NG::Common::Apache::Session::SOAP protected globalStorage -our $VERSION = '1.0.2'; +our $VERSION = '1.0.4'; use base qw(Lemonldap::NG::Common::CGI Exporter); our @ISA; @@ -818,9 +818,9 @@ sub getApacheSession { # Return the absolute path to the htdocs directory where is portal script. # @return path string sub getApacheHtdocsPath { - my $self = shift; - my ( $name, $path, $suffix ) = fileparse( $ENV{SCRIPT_FILENAME} ); - return $path; + my $self = shift; + my ( $name, $path, $suffix ) = fileparse( $ENV{SCRIPT_FILENAME} ); + return $path; } ## @method protected string _md5hash(string s) @@ -1090,8 +1090,17 @@ sub get_module { #@return Safe object sub safe { my $self = shift; - return $safe if ($safe); + # Test if safe already exists + if ($safe) { + + # Refresh the portal object inside it + $safe->{p} = $self; + + return $safe; + } + + # Else create it $safe = Lemonldap::NG::Common::Safe->new($self); # Get custom functions