X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FAuth.pm;h=6be693382b0e2c44dfa34f8605ddd8480a41801d;hb=73f7989fcf23410ebd879d5150f6a13913ca2b90;hp=9301796032f502567d5d0a44a9ba0fa0d8855208;hpb=de935e1f694d55122e39827950ed05f781656b0d;p=kivitendo-erp.git diff --git a/SL/Auth.pm b/SL/Auth.pm index 930179603..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,8 +1246,7 @@ sub assert { } if (!$dont_abort) { - delete $::form->{title}; - $::form->show_generic_error($::locale->text("You do not have the permissions to access this function.")); + $self->deny_access; } return 0; @@ -1324,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. @@ -1340,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.