Refresh portal object in Safe (#284)

This commit is contained in:
Clément Oudot 2011-03-16 13:58:17 +00:00
parent c7970b69ea
commit db97a79752

View File

@ -16,7 +16,7 @@ use MIME::Base64;
use Lemonldap::NG::Common::CGI; use Lemonldap::NG::Common::CGI;
use CGI::Cookie; use CGI::Cookie;
require POSIX; require POSIX;
use Lemonldap::NG::Portal::_i18n; #inherits use Lemonldap::NG::Portal::_i18n; #inherits
use Lemonldap::NG::Common::Apache::Session use Lemonldap::NG::Common::Apache::Session
; #link protected session Apache::Session object ; #link protected session Apache::Session object
use Lemonldap::NG::Common::Safe; #link protected safe Safe object use Lemonldap::NG::Common::Safe; #link protected safe Safe object
@ -63,7 +63,7 @@ use Digest::MD5;
#inherits Apache::Session #inherits Apache::Session
#link Lemonldap::NG::Common::Apache::Session::SOAP protected globalStorage #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); use base qw(Lemonldap::NG::Common::CGI Exporter);
our @ISA; our @ISA;
@ -818,9 +818,9 @@ sub getApacheSession {
# Return the absolute path to the htdocs directory where is portal script. # Return the absolute path to the htdocs directory where is portal script.
# @return path string # @return path string
sub getApacheHtdocsPath { sub getApacheHtdocsPath {
my $self = shift; my $self = shift;
my ( $name, $path, $suffix ) = fileparse( $ENV{SCRIPT_FILENAME} ); my ( $name, $path, $suffix ) = fileparse( $ENV{SCRIPT_FILENAME} );
return $path; return $path;
} }
## @method protected string _md5hash(string s) ## @method protected string _md5hash(string s)
@ -1090,8 +1090,17 @@ sub get_module {
#@return Safe object #@return Safe object
sub safe { sub safe {
my $self = shift; 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); $safe = Lemonldap::NG::Common::Safe->new($self);
# Get custom functions # Get custom functions