From 95c550e848de0973dfc8473dbaaa06797bd712a9 Mon Sep 17 00:00:00 2001 From: Irina Peshinskaya Date: Wed, 14 Sep 2016 18:26:02 +0300 Subject: [PATCH] MT#22657 Close peering API for the reseller role and small texts fixes Change-Id: I172a34b51d7b856b5e1b7b6b4cdfac73898adee0 --- lib/NGCP/Panel/Controller/API/PeeringGroups.pm | 2 +- lib/NGCP/Panel/Controller/API/PeeringGroupsItem.pm | 2 +- lib/NGCP/Panel/Controller/API/PeeringRules.pm | 6 +++--- lib/NGCP/Panel/Controller/API/PeeringRulesItem.pm | 2 +- .../Panel/Controller/API/PeeringServerPreferenceDefs.pm | 2 +- lib/NGCP/Panel/Controller/API/PeeringServerPreferences.pm | 2 +- .../Panel/Controller/API/PeeringServerPreferencesItem.pm | 4 ++-- lib/NGCP/Panel/Controller/API/PeeringServers.pm | 4 ++-- lib/NGCP/Panel/Controller/API/PeeringServersItem.pm | 2 +- lib/NGCP/Panel/Role/API/PeeringGroups.pm | 4 +++- lib/NGCP/Panel/Role/API/PeeringRules.pm | 2 +- lib/NGCP/Panel/Role/API/PeeringServers.pm | 2 +- 12 files changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/NGCP/Panel/Controller/API/PeeringGroups.pm b/lib/NGCP/Panel/Controller/API/PeeringGroups.pm index d6ffc88103..0906226944 100644 --- a/lib/NGCP/Panel/Controller/API/PeeringGroups.pm +++ b/lib/NGCP/Panel/Controller/API/PeeringGroups.pm @@ -58,7 +58,7 @@ __PACKAGE__->config( action => { map { $_ => { ACLDetachTo => '/api/root/invalid_user', - AllowedRole => [qw/admin reseller/], + AllowedRole => [qw/admin/], Args => 0, Does => [qw(ACL CheckTrailingSlash RequireSSL)], Method => $_, diff --git a/lib/NGCP/Panel/Controller/API/PeeringGroupsItem.pm b/lib/NGCP/Panel/Controller/API/PeeringGroupsItem.pm index 0d73d18b91..de7bf7ff43 100644 --- a/lib/NGCP/Panel/Controller/API/PeeringGroupsItem.pm +++ b/lib/NGCP/Panel/Controller/API/PeeringGroupsItem.pm @@ -22,7 +22,7 @@ __PACKAGE__->config( action => { map { $_ => { ACLDetachTo => '/api/root/invalid_user', - AllowedRole => [qw/admin reseller/], + AllowedRole => [qw/admin/], Args => 1, Does => [qw(ACL RequireSSL)], Method => $_, diff --git a/lib/NGCP/Panel/Controller/API/PeeringRules.pm b/lib/NGCP/Panel/Controller/API/PeeringRules.pm index ea27fa2809..7316b5d165 100644 --- a/lib/NGCP/Panel/Controller/API/PeeringRules.pm +++ b/lib/NGCP/Panel/Controller/API/PeeringRules.pm @@ -22,14 +22,14 @@ sub allowed_methods{ } sub api_description { - return 'Defines peering groups.'; + return 'Defines outbound peering rules.'; }; sub query_params { return [ { param => 'group_id', - description => 'Filter for peering rule group', + description => 'Filter for peering group', query => { first => sub { my $q = shift; @@ -79,7 +79,7 @@ __PACKAGE__->config( action => { map { $_ => { ACLDetachTo => '/api/root/invalid_user', - AllowedRole => [qw/admin reseller/], + AllowedRole => [qw/admin/], Args => 0, Does => [qw(ACL CheckTrailingSlash RequireSSL)], Method => $_, diff --git a/lib/NGCP/Panel/Controller/API/PeeringRulesItem.pm b/lib/NGCP/Panel/Controller/API/PeeringRulesItem.pm index 9b25ef8b56..acdd411913 100644 --- a/lib/NGCP/Panel/Controller/API/PeeringRulesItem.pm +++ b/lib/NGCP/Panel/Controller/API/PeeringRulesItem.pm @@ -33,7 +33,7 @@ __PACKAGE__->config( action => { map { $_ => { ACLDetachTo => '/api/root/invalid_user', - AllowedRole => [qw/admin reseller/], + AllowedRole => [qw/admin/], Args => 1, Does => [qw(ACL RequireSSL)], Method => $_, diff --git a/lib/NGCP/Panel/Controller/API/PeeringServerPreferenceDefs.pm b/lib/NGCP/Panel/Controller/API/PeeringServerPreferenceDefs.pm index e10db3a861..84c2424e78 100644 --- a/lib/NGCP/Panel/Controller/API/PeeringServerPreferenceDefs.pm +++ b/lib/NGCP/Panel/Controller/API/PeeringServerPreferenceDefs.pm @@ -38,7 +38,7 @@ __PACKAGE__->config( action => { map { $_ => { ACLDetachTo => '/api/root/invalid_user', - AllowedRole => [qw/admin reseller/], + AllowedRole => [qw/admin/], Args => 0, Does => [qw(ACL CheckTrailingSlash RequireSSL)], Method => $_, diff --git a/lib/NGCP/Panel/Controller/API/PeeringServerPreferences.pm b/lib/NGCP/Panel/Controller/API/PeeringServerPreferences.pm index 9643c42d6b..442e83f5a7 100644 --- a/lib/NGCP/Panel/Controller/API/PeeringServerPreferences.pm +++ b/lib/NGCP/Panel/Controller/API/PeeringServerPreferences.pm @@ -40,7 +40,7 @@ __PACKAGE__->config( action => { map { $_ => { ACLDetachTo => '/api/root/invalid_user', - AllowedRole => [qw/admin reseller/], + AllowedRole => [qw/admin/], Args => 0, Does => [qw(ACL CheckTrailingSlash RequireSSL)], Method => $_, diff --git a/lib/NGCP/Panel/Controller/API/PeeringServerPreferencesItem.pm b/lib/NGCP/Panel/Controller/API/PeeringServerPreferencesItem.pm index 3b6310c528..de7870b452 100644 --- a/lib/NGCP/Panel/Controller/API/PeeringServerPreferencesItem.pm +++ b/lib/NGCP/Panel/Controller/API/PeeringServerPreferencesItem.pm @@ -41,7 +41,7 @@ __PACKAGE__->config( action => { (map { $_ => { ACLDetachTo => '/api/root/invalid_user', - AllowedRole => [qw/admin reseller/], + AllowedRole => [qw/admin/], Args => 1, Does => [qw(ACL RequireSSL)], Method => $_, @@ -49,7 +49,7 @@ __PACKAGE__->config( } } @{ __PACKAGE__->allowed_methods }), @{ __PACKAGE__->get_journal_action_config(__PACKAGE__->resource_name,{ ACLDetachTo => '/api/root/invalid_user', - AllowedRole => [qw/admin reseller/], + AllowedRole => [qw/admin/], Does => [qw(ACL RequireSSL)], }) } }, diff --git a/lib/NGCP/Panel/Controller/API/PeeringServers.pm b/lib/NGCP/Panel/Controller/API/PeeringServers.pm index 7788cf03b4..7768d30493 100644 --- a/lib/NGCP/Panel/Controller/API/PeeringServers.pm +++ b/lib/NGCP/Panel/Controller/API/PeeringServers.pm @@ -22,7 +22,7 @@ sub allowed_methods{ } sub api_description { - return 'Defines peering groups.'; + return 'Defines peering servers.'; }; sub query_params { @@ -100,7 +100,7 @@ __PACKAGE__->config( action => { map { $_ => { ACLDetachTo => '/api/root/invalid_user', - AllowedRole => [qw/admin reseller/], + AllowedRole => [qw/admin/], Args => 0, Does => [qw(ACL CheckTrailingSlash RequireSSL)], Method => $_, diff --git a/lib/NGCP/Panel/Controller/API/PeeringServersItem.pm b/lib/NGCP/Panel/Controller/API/PeeringServersItem.pm index 07f225561f..8ec03c4ae1 100644 --- a/lib/NGCP/Panel/Controller/API/PeeringServersItem.pm +++ b/lib/NGCP/Panel/Controller/API/PeeringServersItem.pm @@ -33,7 +33,7 @@ __PACKAGE__->config( action => { map { $_ => { ACLDetachTo => '/api/root/invalid_user', - AllowedRole => [qw/admin reseller/], + AllowedRole => [qw/admin/], Args => 1, Does => [qw(ACL RequireSSL)], Method => $_, diff --git a/lib/NGCP/Panel/Role/API/PeeringGroups.pm b/lib/NGCP/Panel/Role/API/PeeringGroups.pm index 1d0e861521..c0b4e09831 100644 --- a/lib/NGCP/Panel/Role/API/PeeringGroups.pm +++ b/lib/NGCP/Panel/Role/API/PeeringGroups.pm @@ -24,7 +24,7 @@ sub _item_rs { sub get_form { my ($self, $c) = @_; - return NGCP::Panel::Form::Peering::Group->new; + return NGCP::Panel::Form::Peering::Group->new(ctx => $c); } sub hal_from_item { @@ -42,6 +42,8 @@ sub hal_from_item { Data::HAL::Link->new(relation => 'collection', href => sprintf("/api/%s/", $self->resource_name)), Data::HAL::Link->new(relation => 'profile', href => 'http://purl.org/sipwise/ngcp-api/'), Data::HAL::Link->new(relation => 'self', href => sprintf("%s%d", $self->dispatch_path, $item->id)), + Data::HAL::Link->new(relation => 'ngcp:peeringservers', href => sprintf("/api/peeringservers/?group_id=%d", $item->id)), + Data::HAL::Link->new(relation => 'ngcp:peeringrules', href => sprintf("/api/peeringrules/?group_id=%d", $item->id)), ], relation => 'ngcp:'.$self->resource_name, ); diff --git a/lib/NGCP/Panel/Role/API/PeeringRules.pm b/lib/NGCP/Panel/Role/API/PeeringRules.pm index 4502b8dcb8..7f94ac21e0 100644 --- a/lib/NGCP/Panel/Role/API/PeeringRules.pm +++ b/lib/NGCP/Panel/Role/API/PeeringRules.pm @@ -20,7 +20,7 @@ sub _item_rs { sub get_form { my ($self, $c) = @_; - return NGCP::Panel::Form::Peering::RuleAPI->new; + return NGCP::Panel::Form::Peering::RuleAPI->new(ctx => $c); } sub hal_from_item { diff --git a/lib/NGCP/Panel/Role/API/PeeringServers.pm b/lib/NGCP/Panel/Role/API/PeeringServers.pm index 65a1e9d04c..9a511860f2 100644 --- a/lib/NGCP/Panel/Role/API/PeeringServers.pm +++ b/lib/NGCP/Panel/Role/API/PeeringServers.pm @@ -20,7 +20,7 @@ sub _item_rs { sub get_form { my ($self, $c) = @_; - return NGCP::Panel::Form::Peering::ServerAPI->new; + return NGCP::Panel::Form::Peering::ServerAPI->new(ctx => $c); } sub hal_from_item {