TT#2452 Implement device profile preferences web and api interface

Change-Id: I1a87fe5d93c4798f4bebc9fa04c028f6618a1480
changes/98/7998/5
Irina Peshinskaya 10 years ago
parent eb94e8dea9
commit d7f19af44b

@ -0,0 +1,115 @@
package NGCP::Panel::Controller::API::PbxDeviceProfilePreferenceDefs;
use NGCP::Panel::Utils::Generic qw(:all);
use Sipwise::Base;
use boolean qw(true);
use Data::HAL qw();
use Data::HAL::Link qw();
use HTTP::Headers qw();
use HTTP::Status qw(:constants);
use NGCP::Panel::Utils::DateTime;
use NGCP::Panel::Utils::Preferences;
use Path::Tiny qw(path);
use Safe::Isa qw($_isa);
use JSON::Types qw();
require Catalyst::ActionRole::ACL;
require Catalyst::ActionRole::CheckTrailingSlash;
require NGCP::Panel::Role::HTTPMethods;
require Catalyst::ActionRole::RequireSSL;
sub allowed_methods{
return [qw/GET OPTIONS HEAD/];
}
use parent qw/Catalyst::Controller NGCP::Panel::Role::API/;
sub resource_name{
return 'pbxdeviceprofilepreferencedefs';
}
sub dispatch_path{
return '/api/pbxdeviceprofilepreferencedefs/';
}
sub relation{
return 'http://purl.org/sipwise/ngcp-api/#rel-pbxdeviceprofilepreferencedefs';
}
__PACKAGE__->config(
action => {
map { $_ => {
ACLDetachTo => '/api/root/invalid_user',
AllowedRole => [qw/admin reseller/],
Args => 0,
Does => [qw(ACL CheckTrailingSlash RequireSSL)],
Method => $_,
Path => __PACKAGE__->dispatch_path,
} } @{ __PACKAGE__->allowed_methods }
},
action_roles => [qw(+NGCP::Panel::Role::HTTPMethods)],
);
sub auto :Private {
my ($self, $c) = @_;
$self->set_body($c);
$self->log_request($c);
}
sub GET :Allow {
my ($self, $c) = @_;
{
my @links;
push @links,
Data::HAL::Link->new(
relation => 'curies',
href => 'http://purl.org/sipwise/ngcp-api/#rel-{rel}',
name => 'ngcp',
templated => true,
),
Data::HAL::Link->new(relation => 'profile', href => 'http://purl.org/sipwise/ngcp-api/'),
Data::HAL::Link->new(relation => 'self', href => sprintf('%s', $self->dispatch_path));
my $hal = Data::HAL->new(
links => [@links],
);
my $resource = NGCP::Panel::Utils::Preferences::api_preferences_defs( c => $c, preferences_group => 'dev_pref' );
$hal->resource($resource);
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);
return;
}
return;
}
sub HEAD :Allow {
my ($self, $c) = @_;
$c->forward(qw(GET));
$c->response->body(q());
return;
}
sub OPTIONS :Allow {
my ($self, $c) = @_;
my $allowed_methods = $self->allowed_methods_filtered($c);
$c->response->headers(HTTP::Headers->new(
Allow => join(', ', @{ $allowed_methods }),
Accept_Post => 'application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-'.$self->resource_name,
));
$c->response->content_type('application/json');
$c->response->body(JSON::to_json({ methods => $allowed_methods })."\n");
return;
}
sub end : Private {
my ($self, $c) = @_;
$self->log_response($c);
}
1;
# vim: set tabstop=4 expandtab:

@ -0,0 +1,136 @@
package NGCP::Panel::Controller::API::PbxDeviceProfilePreferences;
use NGCP::Panel::Utils::Generic qw(:all);
use Sipwise::Base;
use boolean qw(true);
use Data::HAL qw();
use Data::HAL::Link qw();
use HTTP::Headers qw();
use HTTP::Status qw(:constants);
use NGCP::Panel::Utils::DateTime;
use Path::Tiny qw(path);
use Safe::Isa qw($_isa);
require Catalyst::ActionRole::ACL;
require Catalyst::ActionRole::CheckTrailingSlash;
require NGCP::Panel::Role::HTTPMethods;
require Catalyst::ActionRole::RequireSSL;
sub allowed_methods{
return [qw/GET OPTIONS HEAD/];
}
sub api_description {
return 'Specifies certain properties (preferences) for a <a href="#pbxdeviceprofiles">PBX Device Profiles</a>. The full list of properties can be obtained via <a href="/api/pbxdeviceprofilepreferencedefs/">PbxDeviceProfilePreferenceDefs</a>.';
};
use parent qw/Catalyst::Controller NGCP::Panel::Role::API::Preferences/;
sub resource_name{
return 'pbxdeviceprofilepreferences';
}
sub dispatch_path{
return '/api/pbxdeviceprofilepreferences/';
}
sub relation{
return 'http://purl.org/sipwise/ngcp-api/#rel-pbxdeviceprofilepreferences';
}
__PACKAGE__->config(
action => {
map { $_ => {
ACLDetachTo => '/api/root/invalid_user',
AllowedRole => [qw/admin reseller/],
Args => 0,
Does => [qw(ACL CheckTrailingSlash RequireSSL)],
Method => $_,
Path => __PACKAGE__->dispatch_path,
} } @{ __PACKAGE__->allowed_methods }
},
action_roles => [qw(+NGCP::Panel::Role::HTTPMethods)],
);
sub auto :Private {
my ($self, $c) = @_;
$self->set_body($c);
$self->log_request($c);
}
sub GET :Allow {
my ($self, $c) = @_;
my $container_type = 'pbxdeviceprofiles';
my $page = $c->request->params->{page} // 1;
my $rows = $c->request->params->{rows} // 10;
{
my $container_items = $self->item_rs($c, $container_type);
(my $total_count, $container_items) = $self->paginate_order_collection($c, $container_items);
my (@embedded, @links);
for my $container_item ($container_items->all) {
push @embedded, $self->hal_from_item($c, $container_item, $container_type);
push @links, Data::HAL::Link->new(
relation => 'ngcp:'.$self->resource_name,
href => sprintf('%s%d', $self->dispatch_path, $container_item->id),
);
}
push @links,
Data::HAL::Link->new(
relation => 'curies',
href => 'http://purl.org/sipwise/ngcp-api/#rel-{rel}',
name => 'ngcp',
templated => true,
),
Data::HAL::Link->new(relation => 'profile', href => 'http://purl.org/sipwise/ngcp-api/'),
Data::HAL::Link->new(relation => 'self', href => sprintf('%s?page=%s&rows=%s', $self->dispatch_path, $page, $rows));
if(($total_count / $rows) > $page ) {
push @links, Data::HAL::Link->new(relation => 'next', href => sprintf('%s?page=%d&rows=%d', $self->dispatch_path, $page + 1, $rows));
}
if($page > 1) {
push @links, Data::HAL::Link->new(relation => 'prev', href => sprintf('%s?page=%d&rows=%d', $self->dispatch_path, $page - 1, $rows));
}
my $hal = Data::HAL->new(
embedded => [@embedded],
links => [@links],
);
$hal->resource({
total_count => $total_count,
});
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);
return;
}
return;
}
sub HEAD :Allow {
my ($self, $c) = @_;
$c->forward(qw(GET));
$c->response->body(q());
return;
}
sub OPTIONS :Allow {
my ($self, $c) = @_;
my $allowed_methods = $self->allowed_methods_filtered($c);
$c->response->headers(HTTP::Headers->new(
Allow => join(', ', @{ $allowed_methods }),
Accept_Post => 'application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-'.$self->resource_name,
));
$c->response->content_type('application/json');
$c->response->body(JSON::to_json({ methods => $allowed_methods })."\n");
return;
}
sub end : Private {
my ($self, $c) = @_;
$self->log_response($c);
}
1;
# vim: set tabstop=4 expandtab:

@ -0,0 +1,220 @@
package NGCP::Panel::Controller::API::PbxDeviceProfilePreferencesItem;
use NGCP::Panel::Utils::Generic qw(:all);
use Sipwise::Base;
use boolean qw(true);
use Data::HAL qw();
use Data::HAL::Link qw();
use HTTP::Headers qw();
use HTTP::Status qw(:constants);
use NGCP::Panel::Utils::ValidateJSON qw();
use NGCP::Panel::Utils::DateTime;
use Path::Tiny qw(path);
use Safe::Isa qw($_isa);
require Catalyst::ActionRole::ACL;
require NGCP::Panel::Role::HTTPMethods;
require Catalyst::ActionRole::RequireSSL;
sub allowed_methods{
return [qw/GET OPTIONS HEAD PATCH PUT/];
}
use parent qw/Catalyst::Controller NGCP::Panel::Role::API::Preferences/;
sub resource_name{
return 'pbxdeviceprofilepreferences';
}
sub dispatch_path{
return '/api/pbxdeviceprofilepreferences/';
}
sub relation{
return 'http://purl.org/sipwise/ngcp-api/#rel-pbxdeviceprofilepreferences';
}
sub journal_query_params {
my($self,$query_params) = @_;
return $self->get_journal_query_params($query_params);
}
__PACKAGE__->config(
action => {
(map { $_ => {
ACLDetachTo => '/api/root/invalid_user',
AllowedRole => [qw/admin reseller/],
Args => 1,
Does => [qw(ACL RequireSSL)],
Method => $_,
Path => __PACKAGE__->dispatch_path,
} } @{ __PACKAGE__->allowed_methods }),
@{ __PACKAGE__->get_journal_action_config(__PACKAGE__->resource_name,{
ACLDetachTo => '/api/root/invalid_user',
AllowedRole => [qw/admin reseller/],
Does => [qw(ACL RequireSSL)],
}) }
},
action_roles => [qw(+NGCP::Panel::Role::HTTPMethods)],
);
sub auto :Private {
my ($self, $c) = @_;
$self->set_body($c);
$self->log_request($c);
}
sub GET :Allow {
my ($self, $c, $id) = @_;
{
last unless $self->valid_id($c, $id);
my $container_type = "pbxdeviceprofiles";
my $preferences_type = "pbxdeviceprofilepreference";
my $container_item = $self->item_by_id($c, $id, $container_type);
last unless $self->resource_exists($c, $preferences_type => $container_item);
my $hal = $self->hal_from_item($c, $container_item, $container_type);
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
(map { # XXX Data::HAL must be able to generate links with multiple relations
s|rel="(http://purl.org/sipwise/ngcp-api/#rel-resellers)"|rel="item $1"|;
s/rel=self/rel="item self"/;
$_
} $hal->http_headers),
), $hal->as_json);
$c->response->headers($response->headers);
$c->response->body($response->content);
return;
}
return;
}
sub HEAD :Allow {
my ($self, $c, $id) = @_;
$c->forward(qw(GET));
$c->response->body(q());
return;
}
sub OPTIONS :Allow {
my ($self, $c, $id) = @_;
my $allowed_methods = $self->allowed_methods_filtered($c);
$c->response->headers(HTTP::Headers->new(
Allow => join(', ', @{ $allowed_methods }),
Accept_Patch => 'application/json-patch+json',
));
$c->response->content_type('application/json');
$c->response->body(JSON::to_json({ methods => $allowed_methods })."\n");
return;
}
sub PATCH :Allow {
my ($self, $c, $id) = @_;
my $guard = $c->model('DB')->txn_scope_guard;
{
my $preference = $self->require_preference($c);
last unless $preference;
my $json = $self->get_valid_patch_data(
c => $c,
id => $id,
media_type => 'application/json-patch+json',
ops => [qw/add replace remove copy/],
);
last unless $json;
my $container_type = "pbxdeviceprofiles";
my $preferences_type = "pbxdeviceprofilepreference";
my $container_item = $self->item_by_id($c, $id, $container_type);
last unless $self->resource_exists($c, $preferences_type => $container_item);
my $old_resource = $self->get_resource($c, $container_item, $container_type);
my $resource = $self->apply_patch($c, $old_resource, $json);
last unless $resource;
# last param is "no replace" to NOT delete existing prefs
# for proper PATCH behavior
$container_item = $self->update_item($c, $container_item, $old_resource, $resource, 0, $container_type);
last unless $container_item;
my $hal = $self->hal_from_item($c, $container_item, $container_type);
last unless $self->add_update_journal_item_hal($c,$hal);
$guard->commit;
if ('minimal' eq $preference) {
$c->response->status(HTTP_NO_CONTENT);
$c->response->header(Preference_Applied => 'return=minimal');
$c->response->body(q());
} else {
#my $hal = $self->hal_from_item($c, $container_item, $container_type);
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
$hal->http_headers,
), $hal->as_json);
$c->response->headers($response->headers);
$c->response->header(Preference_Applied => 'return=representation');
$c->response->body($response->content);
}
}
return;
}
sub PUT :Allow {
my ($self, $c, $id) = @_;
my $guard = $c->model('DB')->txn_scope_guard;
{
my $preference = $self->require_preference($c);
last unless $preference;
my $container_type = "pbxdeviceprofiles";
my $preferences_type = "pbxdeviceprofilepreference";
my $container_item = $self->item_by_id($c, $id, $container_type);
# TODO: systemcontact?
last unless $self->resource_exists($c, $preferences_type => $container_item);
my $resource = $self->get_valid_put_data(
c => $c,
id => $id,
media_type => 'application/json',
);
last unless $resource;
my $old_resource = $self->get_resource($c, $container_item, $container_type);
# last param is "replace" to delete all existing prefs
# for proper PUT behavior
$container_item = $self->update_item($c, $container_item, $old_resource, $resource, 1, $container_type);
last unless $container_item;
my $hal = $self->hal_from_item($c, $container_item, $container_type);
last unless $self->add_update_journal_item_hal($c,$hal);
$guard->commit;
if ('minimal' eq $preference) {
$c->response->status(HTTP_NO_CONTENT);
$c->response->header(Preference_Applied => 'return=minimal');
$c->response->body(q());
} else {
#my $hal = $self->hal_from_item($c, $container_item, $container_type);
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
$hal->http_headers,
), $hal->as_json);
$c->response->headers($response->headers);
$c->response->header(Preference_Applied => 'return=representation');
$c->response->body($response->content);
}
}
return;
}
sub get_journal_methods{
return [qw/handle_item_base_journal handle_journals_get handle_journalsitem_get handle_journals_options handle_journalsitem_options handle_journals_head handle_journalsitem_head/];
}
sub end : Private {
my ($self, $c) = @_;
$self->log_response($c);
}
1;
# vim: set tabstop=4 expandtab:

@ -58,6 +58,7 @@ sub GET : Allow {
"ProfilePreferenceDefs" => 1,
"PeeringServerPreferenceDefs" => 1,
"PbxDevicePreferenceDefs" => 1,
"PbxDeviceProfilePreferenceDefs" => 1,
};
my @colls = $self->get_collections;

@ -2010,6 +2010,79 @@ sub devices_preferences_edit :Chained('devices_preferences_base') :PathPart('edi
return;
}
sub profile_preferences_list :Chained('devprof_base') :PathPart('preferences') :CaptureArgs(0) {
my ($self, $c) = @_;
my $devprof_pref_rs = $c->model('DB')
->resultset('voip_preferences')
->search({
'profile.id' => $c->stash->{devprof}->id,
},{
prefetch => {'voip_devprof_preferences' => 'profile'},
});
my %pref_values;
foreach my $value($devprof_pref_rs->all) {
$pref_values{$value->attribute} =
[ map {$_->value} $value->voip_devprof_preferences->all ];
}
my $pref_values = \%pref_values;
NGCP::Panel::Utils::Preferences::load_preference_list(
c => $c,
pref_values => $pref_values,
'devprof_pref' => 1,
);
$c->stash(template => 'device/profilepreferences.tt');
return;
}
sub profile_preferences_root :Chained('profile_preferences_list') :PathPart('') :Args(0) {
return;
}
sub profile_preferences_base :Chained('profile_preferences_list') :PathPart('') :CaptureArgs(1) {
my ($self, $c, $pref_id) = @_;
$c->stash->{preference_meta} = $c->model('DB')
->resultset('voip_preferences')
->search({
-or => ['voip_preferences_enums.devprof_pref' => 1,
'voip_preferences_enums.devprof_pref' => undef],
},{
prefetch => 'voip_preferences_enums',
})
->find({id => $pref_id});
$c->stash->{preference} = $c->model('DB')
->resultset('voip_devprof_preferences')
->search({
'attribute_id' => $pref_id,
'profile_id' => $c->stash->{devprof}->id,
});
return;
}
sub profile_preferences_edit :Chained('profile_preferences_base') :PathPart('edit') :Args(0) {
my ($self, $c) = @_;
$c->stash(edit_preference => 1);
my @enums = $c->stash->{preference_meta}
->voip_preferences_enums
->all;
my $pref_rs = $c->stash->{devprof}->voip_devprof_preferences;
NGCP::Panel::Utils::Preferences::create_preference_form(
c => $c,
pref_rs => $pref_rs,
enums => \@enums,
base_uri => $c->uri_for_action('/device/profile_preferences_root', [@{ $c->req->captures }[0]] ),
edit_uri => $c->uri_for_action('/device/profile_preferences_edit', $c->req->captures ),
);
return;
}
__PACKAGE__->meta->make_immutable;
1;

@ -80,6 +80,8 @@ sub get_resource {
undef);
} elsif($type eq "pbxdevicemodels") {
$prefs = $item->voip_dev_preferences;
} elsif($type eq "pbxdeviceprofiles") {
$prefs = $item->voip_devprof_preferences;
}
$prefs = $prefs->search({
}, {
@ -236,6 +238,9 @@ sub get_resource {
} elsif($type eq "pbxdevicemodels") {
$resource->{device_id} = int($item->id);
$resource->{id} = int($item->id);
} elsif($type eq "pbxdeviceprofiles") {
$resource->{profile_id} = int($item->id);
$resource->{id} = int($item->id);
} elsif($type eq "contracts") {
$resource->{customer_id} = int($item->id);
$resource->{id} = int($item->id);
@ -308,6 +313,16 @@ sub _item_rs {
} else {
$item_rs = $c->model('DB')->resultset('autoprov_devices')->search({'reseller_id' => $c->user->reseller_id});
}
} elsif($type eq "pbxdeviceprofiles") {
if($c->user->roles eq "admin") {
$item_rs = $c->model('DB')->resultset('autoprov_profiles');
} else {
$item_rs = $c->model('DB')->resultset('autoprov_profiles')->search({
'device.reseller_id' => $c->user->reseller_id
},{
'join' => {'config' => 'device'},
});
}
} elsif($type eq "contracts") {
if($c->user->roles eq "admin") {
$item_rs = $c->model('DB')->resultset('contracts')->search({
@ -370,6 +385,12 @@ sub get_preference_rs {
attribute => $attr,
device => $elem,
);
} elsif($type eq "pbxdeviceprofiles") {
$rs = NGCP::Panel::Utils::Preferences::get_devprof_preference_rs(
c => $c,
attribute => $attr,
profile => $elem,
);
} elsif($type eq "contracts") {
$rs = NGCP::Panel::Utils::Preferences::get_contract_preference_rs(
c => $c,
@ -454,6 +475,16 @@ sub update_item {
$full_rs = $elem->voip_dev_preferences->search_rs();
$pref_type = 'dev_pref';
$reseller_id = $item->reseller_id;
} elsif($type eq "pbxdeviceprofiles") {
delete $resource->{profile_id};
delete $old_resource->{prof};
delete $resource->{pbxdeviceprofilepreferences_id};
delete $old_resource->{pbxdeviceprofilepreferences_id};
$accessor = $item->id;
$elem = $item;
$full_rs = $elem->voip_devprof_preferences->search_rs();
$pref_type = 'devprof_pref';
$reseller_id = $item->config->device->reseller_id;
} else {
return;
}

@ -37,6 +37,7 @@ sub load_preference_list {
my $peer_pref = $params{peer_pref};
my $dom_pref = $params{dom_pref};
my $dev_pref = $params{dev_pref};
my $devprof_pref = $params{devprof_pref};
my $prof_pref = $params{prof_pref};
my $usr_pref = $params{usr_pref};
my $contract_pref = $params{contract_pref};
@ -61,9 +62,12 @@ sub load_preference_list {
$dom_pref ? ('voip_preferences.dom_pref' => 1,
-or => ['voip_preferences_enums.dom_pref' => 1,
'voip_preferences_enums.dom_pref' => undef]) : (),
$dev_pref ? ('voip_preferences.dev_pref' => 1,
$dev_pref ? ('voip_preferences.dev_pref' => 1,
-or => ['voip_preferences_enums.dev_pref' => 1,
'voip_preferences_enums.dev_pref' => undef]) : (),
$devprof_pref ? ('voip_preferences.devprof_pref' => 1,
-or => ['voip_preferences_enums.devprof_pref' => 1,
'voip_preferences_enums.devprof_pref' => undef]) : (),
$prof_pref ? ('voip_preferences.prof_pref' => 1,
-or => ['voip_preferences_enums.prof_pref' => 1,
'voip_preferences_enums.prof_pref' => undef]) : (),
@ -388,6 +392,13 @@ sub create_preference_form {
device_model => $c->stash->{devmod}->{model},
reseller_id => $c->stash->{devmod}->{reseller_id},
);
} elsif ($c->stash->{devprof}) {
%log_data = ( %log_data,
type => 'devprof',
device_id => $c->stash->{devprof}->{id},
device_vendor => $c->stash->{devprof}->{config_id},
device_model => $c->stash->{devprof}->{name},
);
}
if($posted && $form->validated) {
@ -874,6 +885,7 @@ sub get_preferences_rs {
'prof' => [qw/voip_prof_preferences prof_pref profile_id/],
'peer' => [qw/voip_peer_preferences peer_pref peer_host_id/],
'dev' => [qw/voip_dev_preferences dev_pref device_id/],
'devprof' => [qw/voip_devprof_preferences devprof_pref profile_id/],
'contract' => [qw/voip_contract_preferences contract_pref contract_id/],
'contract_location' => [qw/voip_contract_preferences contract_location_pref location_id/],
);
@ -979,6 +991,21 @@ sub get_dev_preference_rs {
device_id => $device->id,
});
}
sub get_devprof_preference_rs {
my %params = @_;
my $c = $params{c};
my $attribute = $params{attribute};
my $profile = $params{profile};
my $preference = $c->model('DB')->resultset('voip_preferences')->find({
attribute => $attribute, 'devprof_pref' => 1,
});
return unless($preference);
return $preference->voip_devprof_preferences->search_rs({
profile_id => $profile->id,
});
}
sub get_contract_preference_rs {
my %params = @_;

@ -239,6 +239,7 @@ $( document ).ready(function() {
helper.dt_buttons = [
{ name = c.loc('Delete'), uri = "/device/profile/'+full.id+'/delete", class = 'btn-small btn-secondary', icon = 'icon-trash' },
{ name = c.loc('Edit'), uri = "/device/profile/'+full.id+'/edit", class = 'btn-small btn-primary', icon = 'icon-edit' },
{ name = c.loc('Preferences'), uri = "/device/profile/'+full.id+'/preferences", class = 'btn-small btn-primary', icon = 'icon-list' },
];
END;

@ -0,0 +1,22 @@
[% site_config.title = c.loc('Device profile "[_1]" - Preferences', devprof.config.device.vendor _ " " _ devprof.config.device.model _ " " _ devprof.name) -%]
[%
helper.messages = messages;
helper.edit_preference = edit_preference;
helper.preference = preference;
helper.preference_meta = preference_meta;
helper.preference_values = preference_values;
helper.pref_groups = pref_groups;
helper.form = form;
helper.base_uri = c.uri_for_action("/device/profile_preferences_root", [c.req.captures.0]);
helper.top_buttons = [
{ name = c.loc('Back'), uri = c.uri_for(""), icon = 'icon-arrow-left' },
];
PROCESS 'helpers/pref_table.tt';
%]
[% # vim: set tabstop=4 syntax=html expandtab: -%]

@ -24,6 +24,7 @@ $fake_data->set_data_from_script({
domain_id => sub { return shift->get_id('domains',@_); },
profile_id => sub { return shift->get_id('subscriberprofiles',@_); },
pbxdevice_id => sub { return shift->get_id('pbxdevicemodels',@_); },
pbxdeviceprofile_id => sub { return shift->get_id('pbxdeviceprofiles',@_); },
rewriteruleset_id => sub { return shift->get_id('rewriterulesets',@_); },
soundset_id => sub { return shift->get_id('soundsets',@_); },
@ -36,7 +37,7 @@ $fake_data->set_data_from_script({
$test_machine->DATA_ITEM_STORE($fake_data->process('preferences'));
$test_machine->form_data_item( );
my @apis = qw/subscriber domain peeringserver customer profile pbxdevice/;
my @apis = qw/subscriber domain peeringserver customer profile pbxdevice pbxdeviceprofile/;
#my @apis = qw/pbxdevice/;
foreach my $api (@apis){

@ -98,6 +98,8 @@ $ua->credentials($netloc, "api_admin_http", $user, $pass);
pbxdevicemodels => 1,
pbxdevicepreferencedefs => 1,
pbxdevicepreferences => 1,
pbxdeviceprofilepreferencedefs => 1,
pbxdeviceprofilepreferences => 1,
pbxdeviceprofiles => 1,
pbxdevices => 1,
peeringgroups => 1,

Loading…
Cancel
Save