X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FAuth.pm;h=6be693382b0e2c44dfa34f8605ddd8480a41801d;hb=abafb475d9742e3a6c28427477235c923b21eeef;hp=82513b98d4d7feb4ddf437440727af09fd4e9d33;hpb=2a496ad85e9117b7cfaaa315b208f478eba30ffd;p=kivitendo-erp.git diff --git a/SL/Auth.pm b/SL/Auth.pm index 82513b98d..6be693382 100644 --- a/SL/Auth.pm +++ b/SL/Auth.pm @@ -879,7 +879,7 @@ sub get_session_value { ($self->{SESSION}{$key} //= SL::Auth::SessionValue->new(auth => $self, key => $key))->get } -sub create_unique_sesion_value { +sub create_unique_session_value { my ($self, $value, %params) = @_; $self->{SESSION} ||= { }; @@ -912,7 +912,7 @@ sub save_form_in_session { $data->{$key} = $form->{$key} if !ref($form->{$key}) || $non_scalars; } - return $self->create_unique_sesion_value($data, %params); + return $self->create_unique_session_value($data, %params); } sub restore_form_from_session { @@ -1229,6 +1229,15 @@ sub check_right { return $granted; } +sub deny_access { + my ($self) = @_; + + $::dispatcher->reply_with_json_error(error => 'access') if $::request->type eq 'json'; + + delete $::form->{title}; + $::form->show_generic_error($::locale->text("You do not have the permissions to access this function.")); +} + sub assert { my ($self, $right, $dont_abort) = @_; @@ -1237,10 +1246,7 @@ sub assert { } if (!$dont_abort) { - $::dispatcher->reply_with_json_error(error => 'access') if $::request->type eq 'json'; - - delete $::form->{title}; - $::form->show_generic_error($::locale->text("You do not have the permissions to access this function.")); + $self->deny_access; } return 0; @@ -1326,7 +1332,7 @@ The values can be any Perl structure. They are stored as YAML dumps. Retrieve a value from the session. Returns C if the value doesn't exist. -=item C +=item C Create a unique key in the session and store C<$value> there. @@ -1342,7 +1348,7 @@ setters nor the deleter access the database. =item C Stores the content of C<$params{form}> (default: C<$::form>) in the -session using L. +session using L. If C<$params{non_scalars}> is trueish then non-scalar values will be stored as well. Default is to only store scalar values.