From 048b0f7720aad820facb048d1a0f34c9add5d5e0 Mon Sep 17 00:00:00 2001 From: Irina Peshinskaya Date: Thu, 18 Oct 2018 13:52:54 +0200 Subject: [PATCH] TT#45960 Disable timesets API for 7.0 (cherry picked from commit 8a24127eed023b65f02cbb66c23c0e7466a37b48) (cherry picked from commit 21490e59ee214a16fcc02ac8a68605f197e9b61e) Change-Id: I3525c6819a71433d90cf400ffeeb76f3b196777a --- lib/NGCP/Panel/Controller/API/Root.pm | 1 + lib/NGCP/Panel/Controller/API/TimeSets.pm | 58 ------------------- lib/NGCP/Panel/Controller/API/TimeSetsItem.pm | 32 ---------- t/api-rest/api-all-links.t | 1 + t/api-rest/api-root.t | 2 +- 5 files changed, 3 insertions(+), 91 deletions(-) delete mode 100644 lib/NGCP/Panel/Controller/API/TimeSets.pm delete mode 100644 lib/NGCP/Panel/Controller/API/TimeSetsItem.pm diff --git a/lib/NGCP/Panel/Controller/API/Root.pm b/lib/NGCP/Panel/Controller/API/Root.pm index 8d0278adea..dd4e1b7e24 100644 --- a/lib/NGCP/Panel/Controller/API/Root.pm +++ b/lib/NGCP/Panel/Controller/API/Root.pm @@ -79,6 +79,7 @@ sub GET : Allow { "PbxDeviceProfilePreferenceDefs" => 1, "PbxFieldDevicePreferenceDefs" => 1, "MetaConfigDefs" => 1, + "TimeSets" => 1, }; my $colls = NGCP::Panel::Utils::API::get_collections_files; diff --git a/lib/NGCP/Panel/Controller/API/TimeSets.pm b/lib/NGCP/Panel/Controller/API/TimeSets.pm deleted file mode 100644 index d33f8a145f..0000000000 --- a/lib/NGCP/Panel/Controller/API/TimeSets.pm +++ /dev/null @@ -1,58 +0,0 @@ -package NGCP::Panel::Controller::API::TimeSets; -use NGCP::Panel::Utils::Generic qw(:all); - -use Sipwise::Base; -use parent qw/NGCP::Panel::Role::Entities NGCP::Panel::Role::API::TimeSets/; - -use HTTP::Status qw(:constants); -use NGCP::Panel::Utils::TimeSet; - -__PACKAGE__->set_config({ - allowed_roles => [qw/admin reseller/], -}); - -sub allowed_methods{ - return [qw/GET POST OPTIONS HEAD/]; -} - -sub api_description { - return 'Defines a collection of (generic) Time Sets, which can each specify a number of ' . - '(recurring) time-slots, which can be currently used in PeeringRules to select certain peerings.'; -} - -sub query_params { - return [ - { - param => 'reseller_id', - description => 'Filter for Time Sets belonging to a specific reseller', - query_type => 'string_eq', - }, - { - param => 'name', - description => 'Filter for items matching a Time Set name pattern', - query_type => 'string_like', - }, - ]; -} - -sub create_item { - my ($self, $c, $resource, $form, $process_extras) = @_; - - my $schema = $c->model('DB'); - my $tset; - - try { - # # no checks, they are in check_resource - $tset = NGCP::Panel::Utils::TimeSet::create_timesets( c => $c, resource => $resource ); - } catch($e) { - $c->log->error("failed to create timeset: $e"); - $self->error($c, HTTP_INTERNAL_SERVER_ERROR, "Failed to create timeset."); - return; - } - - return $tset; -} - -1; - -# vim: set tabstop=4 expandtab: diff --git a/lib/NGCP/Panel/Controller/API/TimeSetsItem.pm b/lib/NGCP/Panel/Controller/API/TimeSetsItem.pm deleted file mode 100644 index 1aef4d3518..0000000000 --- a/lib/NGCP/Panel/Controller/API/TimeSetsItem.pm +++ /dev/null @@ -1,32 +0,0 @@ -package NGCP::Panel::Controller::API::TimeSetsItem; -use NGCP::Panel::Utils::Generic qw(:all); - -use Sipwise::Base; -use parent qw/NGCP::Panel::Role::EntitiesItem NGCP::Panel::Role::API::TimeSets/; - -use HTTP::Status qw(:constants); - -__PACKAGE__->set_config({ - allowed_roles => { - Default => [qw/admin reseller/], - Journal => [qw/admin reseller/], - }, - PATCH => { ops => [qw/add replace remove copy/] }, -}); - -sub allowed_methods{ - return [qw/GET OPTIONS HEAD PATCH PUT DELETE/]; -} - -sub journal_query_params { - my($self,$query_params) = @_; - return $self->get_journal_query_params($query_params); -} - -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/]; -} - -1; - -# vim: set tabstop=4 expandtab: diff --git a/t/api-rest/api-all-links.t b/t/api-rest/api-all-links.t index c8c4345c2c..26f43e397c 100644 --- a/t/api-rest/api-all-links.t +++ b/t/api-rest/api-all-links.t @@ -44,6 +44,7 @@ $ua = Test::Collection->new()->ua(); next if $relname eq "calllists"; next if $relname eq "conversations"; next if $relname eq "phonebookentries"; + next if $relname eq "timesets";#temporarily disabled #my $uri = "$uri/api/$relname/"; #if('conversations' eq $relname){ # $uri .= '?type=call'; diff --git a/t/api-rest/api-root.t b/t/api-rest/api-root.t index f9a9760332..d14fd49e9c 100644 --- a/t/api-rest/api-root.t +++ b/t/api-rest/api-root.t @@ -145,7 +145,7 @@ $ua = Test::Collection->new()->ua(); subscriberregistrations => 1, subscribers => 1, systemcontacts => 1, - timesets => 1, + #timesets => 1, topupcash => 1, topuplogs => 1, topupvouchers => 1,