diff --git a/lib/NGCP/Panel/Controller/API/PbxDeviceProfiles.pm b/lib/NGCP/Panel/Controller/API/PbxDeviceProfiles.pm index 6cf57fbc67..8b82161526 100644 --- a/lib/NGCP/Panel/Controller/API/PbxDeviceProfiles.pm +++ b/lib/NGCP/Panel/Controller/API/PbxDeviceProfiles.pm @@ -124,7 +124,7 @@ sub GET :Allow { $hal->resource({ total_count => $total_count, }); - my $response = HTTP::Response->new(HTTP_OK, undef, + my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new($hal->http_headers(skip_links => 1)), $hal->as_json); $c->response->headers($response->headers); $c->response->body($response->content); @@ -158,7 +158,7 @@ sub POST :Allow { my $guard = $c->model('DB')->txn_scope_guard; { my $resource = $self->get_valid_post_data( - c => $c, + c => $c, media_type => 'application/json', ); last unless $resource; @@ -181,7 +181,7 @@ sub POST :Allow { last; } my $config_rs = $c->model('DB')->resultset('autoprov_configs')->search({ - id => $resource->{config_id}, + 'me.id' => $resource->{config_id}, }); if($c->user->roles eq "admin") { } elsif($c->user->roles eq "reseller") { diff --git a/lib/NGCP/Panel/Controller/API/PbxDeviceProfilesItem.pm b/lib/NGCP/Panel/Controller/API/PbxDeviceProfilesItem.pm index 6e815eed2e..b8c6331d6e 100644 --- a/lib/NGCP/Panel/Controller/API/PbxDeviceProfilesItem.pm +++ b/lib/NGCP/Panel/Controller/API/PbxDeviceProfilesItem.pm @@ -104,7 +104,7 @@ sub PATCH :Allow { last unless $preference; my $json = $self->get_valid_patch_data( - c => $c, + c => $c, id => $id, media_type => 'application/json-patch+json', ); @@ -119,7 +119,7 @@ sub PATCH :Allow { my $form = $self->get_form($c); $item = $self->update_item($c, $item, $old_resource, $resource, $form); last unless $item; - + $guard->commit; if ('minimal' eq $preference) { @@ -160,7 +160,7 @@ sub PUT :Allow { $item = $self->update_item($c, $item, $old_resource, $resource, $form); last unless $item; - $guard->commit; + $guard->commit; if ('minimal' eq $preference) { $c->response->status(HTTP_NO_CONTENT); @@ -192,7 +192,7 @@ sub DELETE :Allow { $_ => $item->id, })->update({ $_ => undef, - }); + }); } $item->delete; diff --git a/lib/NGCP/Panel/Role/API/PbxDeviceProfiles.pm b/lib/NGCP/Panel/Role/API/PbxDeviceProfiles.pm index d37beabd4b..20d90653a6 100644 --- a/lib/NGCP/Panel/Role/API/PbxDeviceProfiles.pm +++ b/lib/NGCP/Panel/Role/API/PbxDeviceProfiles.pm @@ -97,7 +97,7 @@ sub update_item { last; } my $config_rs = $c->model('DB')->resultset('autoprov_configs')->search({ - id => $resource->{config_id}, + 'me.id' => $resource->{config_id}, }); if($c->user->roles eq "admin") { } elsif($c->user->roles eq "reseller") {