From d5aaeae13f7ee92b02903c445b8d7a2daf531d0e Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 5 Jul 2013 14:41:08 +0200 Subject: [PATCH] =?utf8?q?Admin:=20Zuordnungen=20User=20<->=20Gruppen=20<-?= =?utf8?q?>=20Mandanten=20auch=20leeren=20k=C3=B6nnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/Admin.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/SL/Controller/Admin.pm b/SL/Controller/Admin.pm index fe7dac531..bcc9436b7 100644 --- a/SL/Controller/Admin.pm +++ b/SL/Controller/Admin.pm @@ -135,6 +135,10 @@ sub action_save_user { my $props = delete($params->{config_values}) || { }; my $is_new = !$params->{id}; + # Assign empty arrays if the browser doesn't send those controls. + $params->{clients} ||= []; + $params->{groups} ||= []; + $self->user($is_new ? SL::DB::AuthUser->new : SL::DB::AuthUser->new(id => $params->{id})->load) ->assign_attributes(%{ $params }) ->config_values({ %{ $self->user->config_values }, %{ $props } }); @@ -206,6 +210,10 @@ sub action_save_client { my $params = delete($::form->{client}) || { }; my $is_new = !$params->{id}; + # Assign empty arrays if the browser doesn't send those controls. + $params->{groups} ||= []; + $params->{users} ||= []; + $self->client($is_new ? SL::DB::AuthClient->new : SL::DB::AuthClient->new(id => $params->{id})->load)->assign_attributes(%{ $params }); my @errors = $self->client->validate; @@ -278,6 +286,10 @@ sub action_save_group { my $params = delete($::form->{group}) || { }; my $is_new = !$params->{id}; + # Assign empty arrays if the browser doesn't send those controls. + $params->{clients} ||= []; + $params->{users} ||= []; + $self->group($is_new ? SL::DB::AuthGroup->new : SL::DB::AuthGroup->new(id => $params->{id})->load)->assign_attributes(%{ $params }); my @errors = $self->group->validate; -- 2.20.1