X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FSessionFile.pm;h=bf6c313dcffc3e4a4086c588f974bf5cd762c5c9;hb=fee5532a132c44dcfc1743393cba00c8e3397176;hp=f4c509c333ef819c507629eac742cda9211555a7;hpb=008c2e1529744e195616ac2cbf7736f06a90816e;p=kivitendo-erp.git diff --git a/SL/SessionFile.pm b/SL/SessionFile.pm index f4c509c33..bf6c313dc 100644 --- a/SL/SessionFile.pm +++ b/SL/SessionFile.pm @@ -13,6 +13,7 @@ use POSIX qw(strftime); use Rose::Object::MakeMethods::Generic ( scalar => [ qw(fh file_name) ], + 'scalar --get_set_init' => [ qw(session_id) ], ); sub new { @@ -20,6 +21,10 @@ sub new { my $self = $class->SUPER::new; + if ($params{session_id}) { + $self->session_id($params{session_id}) + } + my $path = $self->prepare_path; $file_name =~ s:.*/::g; $file_name = "${path}/${file_name}"; @@ -64,18 +69,22 @@ sub displayable_mtime { } sub get_path { - die "No session ID" unless $::auth->get_session_id; - return "users/session_files/" . $::auth->get_session_id; + die "No session ID" unless $_[0]->session_id; + return "users/session_files/" . $_[0]->session_id; } sub prepare_path { - my $path = get_path(); + my $path = $_[0]->get_path; return $path if -d $path; mkpath $path; die "Creating ${path} failed" unless -d $path; return $path; } +sub init_session_id { + $::auth->get_session_id; +} + sub destroy_session { my ($class, $session_id) = @_;