diff --git a/lib/NGCP/Panel/Controller/API/CCMapEntries.pm b/lib/NGCP/Panel/Controller/API/CCMapEntries.pm
index 8472c69632..f30b8ad412 100644
--- a/lib/NGCP/Panel/Controller/API/CCMapEntries.pm
+++ b/lib/NGCP/Panel/Controller/API/CCMapEntries.pm
@@ -69,7 +69,7 @@ sub GET :Allow {
my (@embedded, @links);
for my $cf ($cfs->all) {
try {
- push @embedded, $self->hal_from_item($c, $cf, "callforwards");
+ push @embedded, $self->hal_from_item($c, $cf, "ccmapentries");
push @links, Data::HAL::Link->new(
relation => 'ngcp:'.$self->resource_name,
href => sprintf('%s%s', $self->dispatch_path, $cf->id),
diff --git a/lib/NGCP/Panel/Controller/API/CCMapEntriesItem.pm b/lib/NGCP/Panel/Controller/API/CCMapEntriesItem.pm
index dedff544db..b8168307be 100644
--- a/lib/NGCP/Panel/Controller/API/CCMapEntriesItem.pm
+++ b/lib/NGCP/Panel/Controller/API/CCMapEntriesItem.pm
@@ -22,16 +22,23 @@ class_has('resource_name', is => 'ro', default => 'ccmapentries');
class_has('dispatch_path', is => 'ro', default => '/api/ccmapentries/');
class_has('relation', is => 'ro', default => 'http://purl.org/sipwise/ngcp-api/#rel-ccmapentries');
+class_has(@{ __PACKAGE__->get_journal_query_params() });
+
__PACKAGE__->config(
action => {
- map { $_ => {
+ (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__->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(HTTPMethods)],
);
@@ -48,10 +55,10 @@ sub GET :Allow {
my ($self, $c, $id) = @_;
{
last unless $self->valid_id($c, $id);
- my $cfm = $self->item_by_id($c, $id, "callforwards");
- last unless $self->resource_exists($c, cfm => $cfm);
+ my $item = $self->item_by_id($c, $id);
+ last unless $self->resource_exists($c, subs_for_ccmapentries => $item);
- my $hal = $self->hal_from_item($c, $cfm, "callforwards");
+ my $hal = $self->hal_from_item($c, $item, "ccmapentries");
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
(map { # XXX Data::HAL must be able to generate links with multiple relations
@@ -100,16 +107,19 @@ sub PATCH :Allow {
);
last unless $json;
- my $callforward = $self->item_by_id($c, $id, "callforwards");
- last unless $self->resource_exists($c, callforward => $callforward);
- my $old_resource = $self->hal_from_item($c, $callforward, "callforwards")->resource;
+ my $item = $self->item_by_id($c, $id);
+ last unless $self->resource_exists($c, subs_for_ccmapentries => $item);
+ my $old_resource = $self->hal_from_item($c, $item, "ccmapentries")->resource;
my $resource = $self->apply_patch($c, $old_resource, $json);
last unless $resource;
my $form = $self->get_form($c);
- $callforward = $self->update_item($c, $callforward, $old_resource, $resource, $form);
- last unless $callforward;
+ $item = $self->update_item($c, $item, $old_resource, $resource, $form);
+ last unless $item;
+ my $hal = $self->hal_from_item($c, $item, "ccmapentries");
+ last unless $self->add_update_journal_item_hal($c,{ hal => $hal, id => $item->id });
+
$guard->commit;
if ('minimal' eq $preference) {
@@ -117,7 +127,7 @@ sub PATCH :Allow {
$c->response->header(Preference_Applied => 'return=minimal');
$c->response->body(q());
} else {
- my $hal = $self->hal_from_item($c, $callforward, "callforwards");
+ #my $hal = $self->hal_from_item($c, $ccmapentry, "ccmapentries");
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
$hal->http_headers,
), $hal->as_json);
@@ -136,8 +146,8 @@ sub PUT :Allow {
my $preference = $self->require_preference($c);
last unless $preference;
- my $callforward = $self->item_by_id($c, $id);
- last unless $self->resource_exists($c, callforward => $callforward);
+ my $item = $self->item_by_id($c, $id);
+ last unless $self->resource_exists($c, subs_for_ccmapentries => $item);
my $resource = $self->get_valid_put_data(
c => $c,
id => $id,
@@ -147,8 +157,11 @@ sub PUT :Allow {
my $old_resource = undef;
my $form = $self->get_form($c);
- $callforward = $self->update_item($c, $callforward, $old_resource, $resource, $form);
- last unless $callforward;
+ $item = $self->update_item($c, $item, $old_resource, $resource, $form);
+ last unless $item;
+
+ my $hal = $self->hal_from_item($c, $item, "ccmapentries");
+ last unless $self->add_update_journal_item_hal($c,{ hal => $hal, id => $item->id });
$guard->commit;
@@ -157,7 +170,7 @@ sub PUT :Allow {
$c->response->header(Preference_Applied => 'return=minimal');
$c->response->body(q());
} else {
- my $hal = $self->hal_from_item($c, $callforward, "callforwards");
+ #my $hal = $self->hal_from_item($c, $item, "ccmapentries");
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
$hal->http_headers,
), $hal->as_json);
@@ -173,10 +186,17 @@ sub DELETE :Allow {
my ($self, $c, $id) = @_;
my $guard = $c->model('DB')->txn_scope_guard;
{
- my $subscriber = $self->item_by_id($c, $id);
- last unless $self->resource_exists($c, ccmapentry => $subscriber);
- my $prov_subs = $subscriber->provisioning_voip_subscriber;
+ my $item = $self->item_by_id($c, $id);
+ last unless $self->resource_exists($c, subs_for_ccmapentries => $item);
+ my $prov_subs = $item->provisioning_voip_subscriber;
last unless $self->resource_exists($c, prov_subs => $prov_subs);
+
+ last unless $self->add_delete_journal_item_hal($c,{ hal_from_item => sub {
+ my $self = shift;
+ my ($c) = @_;
+ return $self->hal_from_item($c,$item,"ccmapentries"); },
+ id => $id});
+
try {
$prov_subs->voip_cc_mappings->delete;
} catch($e) {
@@ -192,6 +212,41 @@ sub DELETE :Allow {
return;
}
+sub item_base_journal :Journal {
+ my $self = shift @_;
+ return $self->handle_item_base_journal(@_);
+}
+
+sub journals_get :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_get(@_);
+}
+
+sub journalsitem_get :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_get(@_);
+}
+
+sub journals_options :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_options(@_);
+}
+
+sub journalsitem_options :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_options(@_);
+}
+
+sub journals_head :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_head(@_);
+}
+
+sub journalsitem_head :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_head(@_);
+}
+
sub end : Private {
my ($self, $c) = @_;
diff --git a/lib/NGCP/Panel/Controller/API/CFDestinationSetsItem.pm b/lib/NGCP/Panel/Controller/API/CFDestinationSetsItem.pm
index 7b2e2b77b8..91b23f2070 100644
--- a/lib/NGCP/Panel/Controller/API/CFDestinationSetsItem.pm
+++ b/lib/NGCP/Panel/Controller/API/CFDestinationSetsItem.pm
@@ -56,7 +56,7 @@ sub GET :Allow {
{
last unless $self->valid_id($c, $id);
my $dset = $self->item_by_id($c, $id);
- last unless $self->resource_exists($c, dset => $dset);
+ last unless $self->resource_exists($c, destinationset => $dset);
my $hal = $self->hal_from_item($c, $dset, "cfdestinationsets");
@@ -147,7 +147,7 @@ sub PUT :Allow {
last unless $preference;
my $dset = $self->item_by_id($c, $id);
- last unless $self->resource_exists($c, cfdestinationset => $dset);
+ last unless $self->resource_exists($c, destinationset => $dset);
my $resource = $self->get_valid_put_data(
c => $c,
id => $id,
diff --git a/lib/NGCP/Panel/Controller/API/CFMappingsItem.pm b/lib/NGCP/Panel/Controller/API/CFMappingsItem.pm
index 99696c5ec3..3a3fc3b1c7 100644
--- a/lib/NGCP/Panel/Controller/API/CFMappingsItem.pm
+++ b/lib/NGCP/Panel/Controller/API/CFMappingsItem.pm
@@ -22,16 +22,23 @@ class_has('resource_name', is => 'ro', default => 'cfmappings');
class_has('dispatch_path', is => 'ro', default => '/api/cfmappings/');
class_has('relation', is => 'ro', default => 'http://purl.org/sipwise/ngcp-api/#rel-cfmappings');
+class_has(@{ __PACKAGE__->get_journal_query_params() });
+
__PACKAGE__->config(
action => {
- map { $_ => {
+ (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__->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(HTTPMethods)],
);
@@ -48,10 +55,10 @@ sub GET :Allow {
my ($self, $c, $id) = @_;
{
last unless $self->valid_id($c, $id);
- my $dset = $self->item_by_id($c, $id);
- last unless $self->resource_exists($c, dset => $dset);
+ my $item = $self->item_by_id($c, $id);
+ last unless $self->resource_exists($c, subscriber => $item);
- my $hal = $self->hal_from_item($c, $dset, "cfdestinationsets");
+ my $hal = $self->hal_from_item($c, $item, "cfmappings");
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
(map { # XXX Data::HAL must be able to generate links with multiple relations
@@ -110,6 +117,9 @@ sub PATCH :Allow {
$item = $self->update_item($c, $item, $old_resource, $resource, $form);
last unless $item;
+ my $hal = $self->hal_from_item($c, $item, "cfmappings");
+ last unless $self->add_update_journal_item_hal($c,{ hal => $hal, id => $item->id });
+
$guard->commit;
if ('minimal' eq $preference) {
@@ -117,7 +127,7 @@ sub PATCH :Allow {
$c->response->header(Preference_Applied => 'return=minimal');
$c->response->body(q());
} else {
- my $hal = $self->hal_from_item($c, $item, "cfmappings");
+ #my $hal = $self->hal_from_item($c, $item, "cfmappings");
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
$hal->http_headers,
), $hal->as_json);
@@ -150,6 +160,9 @@ sub PUT :Allow {
$item = $self->update_item($c, $item, $old_resource, $resource, $form);
last unless $item;
+ my $hal = $self->hal_from_item($c, $item, "cfmappings");
+ last unless $self->add_update_journal_item_hal($c,{ hal => $hal, id => $item->id });
+
$guard->commit;
if ('minimal' eq $preference) {
@@ -157,7 +170,7 @@ sub PUT :Allow {
$c->response->header(Preference_Applied => 'return=minimal');
$c->response->body(q());
} else {
- my $hal = $self->hal_from_item($c, $item, "cfmappings");
+ #my $hal = $self->hal_from_item($c, $item, "cfmappings");
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
$hal->http_headers,
), $hal->as_json);
@@ -169,6 +182,41 @@ sub PUT :Allow {
return;
}
+sub item_base_journal :Journal {
+ my $self = shift @_;
+ return $self->handle_item_base_journal(@_);
+}
+
+sub journals_get :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_get(@_);
+}
+
+sub journalsitem_get :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_get(@_);
+}
+
+sub journals_options :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_options(@_);
+}
+
+sub journalsitem_options :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_options(@_);
+}
+
+sub journals_head :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_head(@_);
+}
+
+sub journalsitem_head :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_head(@_);
+}
+
sub end : Private {
my ($self, $c) = @_;
diff --git a/lib/NGCP/Panel/Controller/API/CFTimeSetsItem.pm b/lib/NGCP/Panel/Controller/API/CFTimeSetsItem.pm
index 1b1aa1fc71..79666bc161 100644
--- a/lib/NGCP/Panel/Controller/API/CFTimeSetsItem.pm
+++ b/lib/NGCP/Panel/Controller/API/CFTimeSetsItem.pm
@@ -108,7 +108,7 @@ sub PATCH :Allow {
last unless $json;
my $tset = $self->item_by_id($c, $id);
- last unless $self->resource_exists($c, cftimeset => $tset);
+ last unless $self->resource_exists($c, timeset => $tset);
my $old_resource = $self->hal_from_item($c, $tset, "cftimesets")->resource;
my $resource = $self->apply_patch($c, $old_resource, $json);
last unless $resource;
@@ -147,7 +147,7 @@ sub PUT :Allow {
last unless $preference;
my $tset = $self->item_by_id($c, $id);
- last unless $self->resource_exists($c, cftimeset => $tset);
+ last unless $self->resource_exists($c, timeset => $tset);
my $resource = $self->get_valid_put_data(
c => $c,
id => $id,
diff --git a/lib/NGCP/Panel/Controller/API/CallForwardsItem.pm b/lib/NGCP/Panel/Controller/API/CallForwardsItem.pm
index dd4d58233f..43cf1d050b 100644
--- a/lib/NGCP/Panel/Controller/API/CallForwardsItem.pm
+++ b/lib/NGCP/Panel/Controller/API/CallForwardsItem.pm
@@ -55,10 +55,10 @@ sub GET :Allow {
my ($self, $c, $id) = @_;
{
last unless $self->valid_id($c, $id);
- my $cfm = $self->item_by_id($c, $id, "callforwards");
- last unless $self->resource_exists($c, cfm => $cfm);
+ my $item = $self->item_by_id($c, $id);
+ last unless $self->resource_exists($c, subscriber => $item);
- my $hal = $self->hal_from_item($c, $cfm, "callforwards");
+ my $hal = $self->hal_from_item($c, $item, "callforwards");
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
(map { # XXX Data::HAL must be able to generate links with multiple relations
@@ -107,18 +107,18 @@ sub PATCH :Allow {
);
last unless $json;
- my $callforward = $self->item_by_id($c, $id, "callforwards");
- last unless $self->resource_exists($c, callforward => $callforward);
- my $old_resource = $self->hal_from_item($c, $callforward, "callforwards")->resource;
+ my $item = $self->item_by_id($c, $id);
+ last unless $self->resource_exists($c, subs_for_callforwards => $item);
+ my $old_resource = $self->hal_from_item($c, $item, "callforwards")->resource;
my $resource = $self->apply_patch($c, $old_resource, $json);
last unless $resource;
my $form = $self->get_form($c);
- $callforward = $self->update_item($c, $callforward, $old_resource, $resource, $form);
- last unless $callforward;
+ $item = $self->update_item($c, $item, $old_resource, $resource, $form);
+ last unless $item;
- my $hal = $self->hal_from_item($c, $callforward, "callforwards");
- last unless $self->add_update_journal_item_hal($c,$hal);
+ my $hal = $self->hal_from_item($c, $item, "callforwards");
+ last unless $self->add_update_journal_item_hal($c,{ hal => $hal, id => $id });
$guard->commit;
@@ -146,8 +146,8 @@ sub PUT :Allow {
my $preference = $self->require_preference($c);
last unless $preference;
- my $callforward = $self->item_by_id($c, $id, "callforwards");
- last unless $self->resource_exists($c, callforward => $callforward);
+ my $item = $self->item_by_id($c, $id);
+ last unless $self->resource_exists($c, subs_for_callforward => $item);
my $resource = $self->get_valid_put_data(
c => $c,
id => $id,
@@ -157,11 +157,11 @@ sub PUT :Allow {
my $old_resource = undef;
my $form = $self->get_form($c);
- $callforward = $self->update_item($c, $callforward, $old_resource, $resource, $form);
- last unless $callforward;
+ $item = $self->update_item($c, $item, $old_resource, $resource, $form);
+ last unless $item;
- my $hal = $self->hal_from_item($c, $callforward, "callforwards");
- last unless $self->add_update_journal_item_hal($c,$hal);
+ my $hal = $self->hal_from_item($c, $item, "callforwards");
+ last unless $self->add_update_journal_item_hal($c,{ hal => $hal, id => $id });
$guard->commit;
@@ -186,8 +186,8 @@ sub DELETE :Allow {
my ($self, $c, $id) = @_;
my $guard = $c->model('DB')->txn_scope_guard;
{
- my $callforward = $self->item_by_id($c, $id, "callforwards");
- last unless $self->resource_exists($c, callforward => $callforward);
+ my $item = $self->item_by_id($c, $id);
+ last unless $self->resource_exists($c, subs_for_callforward => $item);
my $form = $self->get_form($c);
my $old_resource = undef;
my $resource = $self->get_valid_put_data(
@@ -196,20 +196,22 @@ sub DELETE :Allow {
media_type => 'application/json',
);
$resource //= {};
+
+ last unless $self->add_delete_journal_item_hal($c,{ hal_from_item => sub {
+ my $self = shift;
+ my ($c) = @_;
+ #my $_callforward = $self->item_by_id($c, $id, "callforwards");
+ return $self->hal_from_item($c,$item,"callforwards"); },
+ id => $id});
+
try {
- $callforward = $self->update_item($c, $callforward, $old_resource, $resource, $form);
+ $item = $self->update_item($c, $item, $old_resource, $resource, $form);
} catch($e) {
$c->log->error("Failed to delete callforward with id '$id': $e");
$self->error($c, HTTP_INTERNAL_SERVER_ERROR, "Internal Server Error");
last;
}
- last unless $self->add_delete_journal_item_hal($c,sub {
- my $self = shift;
- my ($c) = @_;
- #my $_callforward = $self->item_by_id($c, $id, "callforwards");
- return $self->hal_from_item($c,$callforward); });
-
$guard->commit;
$c->response->status(HTTP_NO_CONTENT);
@@ -218,6 +220,41 @@ sub DELETE :Allow {
return;
}
+sub item_base_journal :Journal {
+ my $self = shift @_;
+ return $self->handle_item_base_journal(@_);
+}
+
+sub journals_get :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_get(@_);
+}
+
+sub journalsitem_get :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_get(@_);
+}
+
+sub journals_options :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_options(@_);
+}
+
+sub journalsitem_options :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_options(@_);
+}
+
+sub journals_head :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_head(@_);
+}
+
+sub journalsitem_head :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_head(@_);
+}
+
sub end : Private {
my ($self, $c) = @_;
diff --git a/lib/NGCP/Panel/Controller/API/FaxserverSettingsItem.pm b/lib/NGCP/Panel/Controller/API/FaxserverSettingsItem.pm
index 7eadb363b6..d814220ae0 100644
--- a/lib/NGCP/Panel/Controller/API/FaxserverSettingsItem.pm
+++ b/lib/NGCP/Panel/Controller/API/FaxserverSettingsItem.pm
@@ -22,16 +22,23 @@ class_has('resource_name', is => 'ro', default => 'faxserversettings');
class_has('dispatch_path', is => 'ro', default => '/api/faxserversettings/');
class_has('relation', is => 'ro', default => 'http://purl.org/sipwise/ngcp-api/#rel-faxserversettings');
+class_has(@{ __PACKAGE__->get_journal_query_params() });
+
__PACKAGE__->config(
action => {
- map { $_ => {
+ (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__->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(HTTPMethods)],
);
@@ -48,10 +55,10 @@ sub GET :Allow {
my ($self, $c, $id) = @_;
{
last unless $self->valid_id($c, $id);
- my $cfm = $self->item_by_id($c, $id);
- last unless $self->resource_exists($c, cfm => $cfm);
+ my $subs = $self->item_by_id($c, $id);
+ last unless $self->resource_exists($c, faxserversettings => $subs);
- my $hal = $self->hal_from_item($c, $cfm);
+ my $hal = $self->hal_from_item($c, $subs);
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
(map { # XXX Data::HAL must be able to generate links with multiple relations
@@ -110,6 +117,9 @@ sub PATCH :Allow {
$item = $self->update_item($c, $item, $old_resource, $resource, $form);
last unless $item;
+ my $hal = $self->hal_from_item($c, $item);
+ last unless $self->add_update_journal_item_hal($c,{ hal => $hal, id => $item->id });
+
$guard->commit;
if ('minimal' eq $preference) {
@@ -117,7 +127,7 @@ sub PATCH :Allow {
$c->response->header(Preference_Applied => 'return=minimal');
$c->response->body(q());
} else {
- my $hal = $self->hal_from_item($c, $item);
+ #my $hal = $self->hal_from_item($c, $item);
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
$hal->http_headers,
), $hal->as_json);
@@ -149,6 +159,9 @@ sub PUT :Allow {
my $form = $self->get_form($c);
$item = $self->update_item($c, $item, $old_resource, $resource, $form);
last unless $item;
+
+ my $hal = $self->hal_from_item($c, $item);
+ last unless $self->add_update_journal_item_hal($c,{ hal => $hal, id => $item->id });
$guard->commit;
@@ -157,7 +170,7 @@ sub PUT :Allow {
$c->response->header(Preference_Applied => 'return=minimal');
$c->response->body(q());
} else {
- my $hal = $self->hal_from_item($c, $item);
+ #my $hal = $self->hal_from_item($c, $item);
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
$hal->http_headers,
), $hal->as_json);
@@ -169,6 +182,41 @@ sub PUT :Allow {
return;
}
+sub item_base_journal :Journal {
+ my $self = shift @_;
+ return $self->handle_item_base_journal(@_);
+}
+
+sub journals_get :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_get(@_);
+}
+
+sub journalsitem_get :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_get(@_);
+}
+
+sub journals_options :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_options(@_);
+}
+
+sub journalsitem_options :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_options(@_);
+}
+
+sub journals_head :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_head(@_);
+}
+
+sub journalsitem_head :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_head(@_);
+}
+
sub end : Private {
my ($self, $c) = @_;
diff --git a/lib/NGCP/Panel/Controller/API/Reminders.pm b/lib/NGCP/Panel/Controller/API/Reminders.pm
index fc1732f4ae..7963f81b36 100644
--- a/lib/NGCP/Panel/Controller/API/Reminders.pm
+++ b/lib/NGCP/Panel/Controller/API/Reminders.pm
@@ -197,6 +197,12 @@ sub POST :Allow {
$self->error($c, HTTP_INTERNAL_SERVER_ERROR, "Failed to create reminder.");
last;
}
+
+ last unless $self->add_create_journal_item_hal($c,sub {
+ my $self = shift;
+ my ($c) = @_;
+ my $_item = $self->item_by_id($c, $item->id);
+ return $self->hal_from_item($c, $_item, $form); });
$guard->commit;
diff --git a/lib/NGCP/Panel/Controller/API/RemindersItem.pm b/lib/NGCP/Panel/Controller/API/RemindersItem.pm
index 4c8b7c95e7..d8dfdae0a9 100644
--- a/lib/NGCP/Panel/Controller/API/RemindersItem.pm
+++ b/lib/NGCP/Panel/Controller/API/RemindersItem.pm
@@ -19,16 +19,23 @@ class_has('resource_name', is => 'ro', default => 'reminders');
class_has('dispatch_path', is => 'ro', default => '/api/reminders/');
class_has('relation', is => 'ro', default => 'http://purl.org/sipwise/ngcp-api/#rel-reminders');
+class_has(@{ __PACKAGE__->get_journal_query_params() });
+
__PACKAGE__->config(
action => {
- map { $_ => {
+ (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__->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(HTTPMethods)],
);
@@ -106,6 +113,9 @@ sub PATCH :Allow {
$item = $self->update_item($c, $item, $old_resource, $resource, $form);
last unless $item;
+ my $hal = $self->hal_from_item($c, $item, $form);
+ last unless $self->add_update_journal_item_hal($c,$hal);
+
$guard->commit;
if ('minimal' eq $preference) {
@@ -113,7 +123,7 @@ sub PATCH :Allow {
$c->response->header(Preference_Applied => 'return=minimal');
$c->response->body(q());
} else {
- my $hal = $self->hal_from_item($c, $item, $form);
+ #my $hal = $self->hal_from_item($c, $item, $form);
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
$hal->http_headers,
), $hal->as_json);
@@ -146,6 +156,9 @@ sub PUT :Allow {
$item = $self->update_item($c, $item, $old_resource, $resource, $form);
last unless $item;
+ my $hal = $self->hal_from_item($c, $item, $form);
+ last unless $self->add_update_journal_item_hal($c,$hal);
+
$guard->commit;
if ('minimal' eq $preference) {
@@ -153,7 +166,7 @@ sub PUT :Allow {
$c->response->header(Preference_Applied => 'return=minimal');
$c->response->body(q());
} else {
- my $hal = $self->hal_from_item($c, $item, $form);
+ #my $hal = $self->hal_from_item($c, $item, $form);
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
$hal->http_headers,
), $hal->as_json);
@@ -172,6 +185,13 @@ sub DELETE :Allow {
{
my $item = $self->item_by_id($c, $id);
last unless $self->resource_exists($c, reminder => $item);
+
+ last unless $self->add_delete_journal_item_hal($c,sub {
+ my $self = shift;
+ my ($c) = @_;
+ my $_form = $self->get_form($c);
+ return $self->hal_from_item($c, $item, $_form); });
+
$item->delete;
$guard->commit;
@@ -182,6 +202,41 @@ sub DELETE :Allow {
return;
}
+sub item_base_journal :Journal {
+ my $self = shift @_;
+ return $self->handle_item_base_journal(@_);
+}
+
+sub journals_get :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_get(@_);
+}
+
+sub journalsitem_get :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_get(@_);
+}
+
+sub journals_options :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_options(@_);
+}
+
+sub journalsitem_options :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_options(@_);
+}
+
+sub journals_head :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_head(@_);
+}
+
+sub journalsitem_head :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_head(@_);
+}
+
sub end : Private {
my ($self, $c) = @_;
diff --git a/lib/NGCP/Panel/Controller/API/SpeedDialsItem.pm b/lib/NGCP/Panel/Controller/API/SpeedDialsItem.pm
index 22ac130834..290cab0da6 100644
--- a/lib/NGCP/Panel/Controller/API/SpeedDialsItem.pm
+++ b/lib/NGCP/Panel/Controller/API/SpeedDialsItem.pm
@@ -22,16 +22,23 @@ class_has('resource_name', is => 'ro', default => 'speeddials');
class_has('dispatch_path', is => 'ro', default => '/api/speeddials/');
class_has('relation', is => 'ro', default => 'http://purl.org/sipwise/ngcp-api/#rel-speeddials');
+class_has(@{ __PACKAGE__->get_journal_query_params() });
+
__PACKAGE__->config(
action => {
- map { $_ => {
+ (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__->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(HTTPMethods)],
);
@@ -106,6 +113,9 @@ sub PUT :Allow {
$subscriber = $self->update_item($c, $subscriber, undef, $resource, $form);
last unless $subscriber;
+ my $hal = $self->hal_from_item($c, $subscriber);
+ last unless $self->add_update_journal_item_hal($c,{ hal => $hal, id => $subscriber->id });
+
$guard->commit;
if ('minimal' eq $preference) {
@@ -113,7 +123,7 @@ sub PUT :Allow {
$c->response->header(Preference_Applied => 'return=minimal');
$c->response->body(q());
} else {
- my $hal = $self->hal_from_item($c, $subscriber);
+ #my $hal = $self->hal_from_item($c, $subscriber);
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
$hal->http_headers,
), $hal->as_json);
@@ -151,6 +161,9 @@ sub PATCH :Allow {
$subscriber = $self->update_item($c, $subscriber, undef, $resource, $form);
last unless $subscriber;
+ my $hal = $self->hal_from_item($c, $subscriber);
+ last unless $self->add_update_journal_item_hal($c,{ hal => $hal, id => $subscriber->id });
+
$guard->commit;
if ('minimal' eq $preference) {
@@ -158,7 +171,7 @@ sub PATCH :Allow {
$c->response->header(Preference_Applied => 'return=minimal');
$c->response->body(q());
} else {
- my $hal = $self->hal_from_item($c, $subscriber);
+ #my $hal = $self->hal_from_item($c, $subscriber);
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
$hal->http_headers,
), $hal->as_json);
@@ -170,6 +183,41 @@ sub PATCH :Allow {
return;
}
+sub item_base_journal :Journal {
+ my $self = shift @_;
+ return $self->handle_item_base_journal(@_);
+}
+
+sub journals_get :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_get(@_);
+}
+
+sub journalsitem_get :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_get(@_);
+}
+
+sub journals_options :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_options(@_);
+}
+
+sub journalsitem_options :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_options(@_);
+}
+
+sub journals_head :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_head(@_);
+}
+
+sub journalsitem_head :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_head(@_);
+}
+
sub end : Private {
my ($self, $c) = @_;
diff --git a/lib/NGCP/Panel/Controller/API/TrustedSources.pm b/lib/NGCP/Panel/Controller/API/TrustedSources.pm
index 0ceb162c06..235683fcaf 100644
--- a/lib/NGCP/Panel/Controller/API/TrustedSources.pm
+++ b/lib/NGCP/Panel/Controller/API/TrustedSources.pm
@@ -186,6 +186,12 @@ sub POST :Allow {
last;
}
+ last unless $self->add_create_journal_item_hal($c,sub {
+ my $self = shift;
+ my ($c) = @_;
+ my $_item = $self->item_by_id($c, $item->id);
+ return $self->hal_from_item($c, $_item, $form); });
+
$guard->commit;
$c->response->status(HTTP_CREATED);
diff --git a/lib/NGCP/Panel/Controller/API/TrustedSourcesItem.pm b/lib/NGCP/Panel/Controller/API/TrustedSourcesItem.pm
index 12a9381f0d..d381ed6f45 100644
--- a/lib/NGCP/Panel/Controller/API/TrustedSourcesItem.pm
+++ b/lib/NGCP/Panel/Controller/API/TrustedSourcesItem.pm
@@ -19,16 +19,23 @@ class_has('resource_name', is => 'ro', default => 'trustedsources');
class_has('dispatch_path', is => 'ro', default => '/api/trustedsources/');
class_has('relation', is => 'ro', default => 'http://purl.org/sipwise/ngcp-api/#rel-trustedsources');
+class_has(@{ __PACKAGE__->get_journal_query_params() });
+
__PACKAGE__->config(
action => {
- map { $_ => {
+ (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__->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(HTTPMethods)],
);
@@ -106,6 +113,9 @@ sub PATCH :Allow {
$item = $self->update_item($c, $item, $old_resource, $resource, $form);
last unless $item;
+ my $hal = $self->hal_from_item($c, $item, $form);
+ last unless $self->add_update_journal_item_hal($c,$hal);
+
$guard->commit;
if ('minimal' eq $preference) {
@@ -113,7 +123,7 @@ sub PATCH :Allow {
$c->response->header(Preference_Applied => 'return=minimal');
$c->response->body(q());
} else {
- my $hal = $self->hal_from_item($c, $item, $form);
+ #my $hal = $self->hal_from_item($c, $item, $form);
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
$hal->http_headers,
), $hal->as_json);
@@ -146,6 +156,9 @@ sub PUT :Allow {
$item = $self->update_item($c, $item, $old_resource, $resource, $form);
last unless $item;
+ my $hal = $self->hal_from_item($c, $item, $form);
+ last unless $self->add_update_journal_item_hal($c,$hal);
+
$guard->commit;
if ('minimal' eq $preference) {
@@ -153,7 +166,7 @@ sub PUT :Allow {
$c->response->header(Preference_Applied => 'return=minimal');
$c->response->body(q());
} else {
- my $hal = $self->hal_from_item($c, $item, $form);
+ #my $hal = $self->hal_from_item($c, $item, $form);
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
$hal->http_headers,
), $hal->as_json);
@@ -172,6 +185,13 @@ sub DELETE :Allow {
{
my $item = $self->item_by_id($c, $id);
last unless $self->resource_exists($c, trustedsource => $item);
+
+ last unless $self->add_delete_journal_item_hal($c,sub {
+ my $self = shift;
+ my ($c) = @_;
+ my $_form = $self->get_form($c);
+ return $self->hal_from_item($c, $item, $_form); });
+
$item->delete;
$guard->commit;
@@ -182,6 +202,41 @@ sub DELETE :Allow {
return;
}
+sub item_base_journal :Journal {
+ my $self = shift @_;
+ return $self->handle_item_base_journal(@_);
+}
+
+sub journals_get :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_get(@_);
+}
+
+sub journalsitem_get :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_get(@_);
+}
+
+sub journals_options :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_options(@_);
+}
+
+sub journalsitem_options :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_options(@_);
+}
+
+sub journals_head :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_head(@_);
+}
+
+sub journalsitem_head :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_head(@_);
+}
+
sub end : Private {
my ($self, $c) = @_;
diff --git a/lib/NGCP/Panel/Controller/API/VoicemailSettingsItem.pm b/lib/NGCP/Panel/Controller/API/VoicemailSettingsItem.pm
index f4fd94e5ae..2d95150279 100644
--- a/lib/NGCP/Panel/Controller/API/VoicemailSettingsItem.pm
+++ b/lib/NGCP/Panel/Controller/API/VoicemailSettingsItem.pm
@@ -19,16 +19,23 @@ class_has('resource_name', is => 'ro', default => 'voicemailsettings');
class_has('dispatch_path', is => 'ro', default => '/api/voicemailsettings/');
class_has('relation', is => 'ro', default => 'http://purl.org/sipwise/ngcp-api/#rel-voicemailsettings');
+class_has(@{ __PACKAGE__->get_journal_query_params() });
+
__PACKAGE__->config(
action => {
- map { $_ => {
+ (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__->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(HTTPMethods)],
);
@@ -106,6 +113,9 @@ sub PATCH :Allow {
$item = $self->update_item($c, $item, $old_resource, $resource, $form);
last unless $item;
+ my $hal = $self->hal_from_item($c, $item, $form);
+ last unless $self->add_update_journal_item_hal($c,$hal);
+
$guard->commit;
if ('minimal' eq $preference) {
@@ -113,7 +123,7 @@ sub PATCH :Allow {
$c->response->header(Preference_Applied => 'return=minimal');
$c->response->body(q());
} else {
- my $hal = $self->hal_from_item($c, $item, $form);
+ #my $hal = $self->hal_from_item($c, $item, $form);
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
$hal->http_headers,
), $hal->as_json);
@@ -145,6 +155,9 @@ sub PUT :Allow {
$item = $self->update_item($c, $item, $old_resource, $resource, $form);
last unless $item;
+ my $hal = $self->hal_from_item($c, $item, $form);
+ last unless $self->add_update_journal_item_hal($c,$hal);
+
$guard->commit;
if ('minimal' eq $preference) {
@@ -152,7 +165,7 @@ sub PUT :Allow {
$c->response->header(Preference_Applied => 'return=minimal');
$c->response->body(q());
} else {
- my $hal = $self->hal_from_item($c, $item, $form);
+ #my $hal = $self->hal_from_item($c, $item, $form);
my $response = HTTP::Response->new(HTTP_OK, undef, HTTP::Headers->new(
$hal->http_headers,
), $hal->as_json);
@@ -164,6 +177,41 @@ sub PUT :Allow {
return;
}
+sub item_base_journal :Journal {
+ my $self = shift @_;
+ return $self->handle_item_base_journal(@_);
+}
+
+sub journals_get :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_get(@_);
+}
+
+sub journalsitem_get :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_get(@_);
+}
+
+sub journals_options :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_options(@_);
+}
+
+sub journalsitem_options :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_options(@_);
+}
+
+sub journals_head :Journal {
+ my $self = shift @_;
+ return $self->handle_journals_head(@_);
+}
+
+sub journalsitem_head :Journal {
+ my $self = shift @_;
+ return $self->handle_journalsitem_head(@_);
+}
+
sub end : Private {
my ($self, $c) = @_;
diff --git a/lib/NGCP/Panel/Controller/Peering.pm b/lib/NGCP/Panel/Controller/Peering.pm
index 4780ac41af..a4dca92566 100644
--- a/lib/NGCP/Panel/Controller/Peering.pm
+++ b/lib/NGCP/Panel/Controller/Peering.pm
@@ -7,7 +7,7 @@ BEGIN { extends 'Catalyst::Controller'; }
use NGCP::Panel::Form::PeeringGroup;
use NGCP::Panel::Form::PeeringRule;
use NGCP::Panel::Form::PeeringServer;
-#use NGCP::Panel::Utils::DialogicImg;
+use NGCP::Panel::Utils::DialogicImg;
use NGCP::Panel::Utils::Message;
use NGCP::Panel::Utils::Navigation;
use NGCP::Panel::Utils::Preferences;
diff --git a/lib/NGCP/Panel/Role/API/CCMapEntries.pm b/lib/NGCP/Panel/Role/API/CCMapEntries.pm
index c1f9c6c0e5..170d557dcf 100644
--- a/lib/NGCP/Panel/Role/API/CCMapEntries.pm
+++ b/lib/NGCP/Panel/Role/API/CCMapEntries.pm
@@ -45,6 +45,7 @@ sub hal_from_item {
Data::HAL::Link->new(relation => 'self', href => sprintf("%s%s", $self->dispatch_path, $item->id)),
Data::HAL::Link->new(relation => "ngcp:$type", href => sprintf("/api/%s/%s", $type, $item->id)),
Data::HAL::Link->new(relation => 'ngcp:subscribers', href => sprintf("/api/subscribers/%d", $item->id)),
+ $self->get_journal_relation_link($item->id),
],
relation => 'ngcp:'.$self->resource_name,
);
diff --git a/lib/NGCP/Panel/Role/API/CFMappings.pm b/lib/NGCP/Panel/Role/API/CFMappings.pm
index 6fb891d526..ac90f626ff 100644
--- a/lib/NGCP/Panel/Role/API/CFMappings.pm
+++ b/lib/NGCP/Panel/Role/API/CFMappings.pm
@@ -55,6 +55,7 @@ sub hal_from_item {
Data::HAL::Link->new(relation => 'self', href => sprintf("%s%d", $self->dispatch_path, $item->id)),
Data::HAL::Link->new(relation => "ngcp:$type", href => sprintf("/api/%s/%d", $type, $item->id)),
Data::HAL::Link->new(relation => "ngcp:subscribers", href => sprintf("/api/subscribers/%d", $b_subs_id)),
+ $self->get_journal_relation_link($item->id),
],
relation => 'ngcp:'.$self->resource_name,
);
diff --git a/lib/NGCP/Panel/Role/API/CallForwards.pm b/lib/NGCP/Panel/Role/API/CallForwards.pm
index 756d806efc..0f4e3060f4 100644
--- a/lib/NGCP/Panel/Role/API/CallForwards.pm
+++ b/lib/NGCP/Panel/Role/API/CallForwards.pm
@@ -24,7 +24,7 @@ sub get_form {
sub hal_from_item {
my ($self, $c, $item, $type) = @_;
my $form;
- my $rwr_form = $self->get_form($c, "rules");
+ #my $rwr_form = $self->get_form($c, "rules"); #rules?
my $prov_subs = $item->provisioning_voip_subscriber;
diff --git a/lib/NGCP/Panel/Role/API/FaxserverSettings.pm b/lib/NGCP/Panel/Role/API/FaxserverSettings.pm
index 1d32386ad7..62afb22465 100644
--- a/lib/NGCP/Panel/Role/API/FaxserverSettings.pm
+++ b/lib/NGCP/Panel/Role/API/FaxserverSettings.pm
@@ -65,6 +65,7 @@ sub hal_from_item {
Data::HAL::Link->new(relation => 'self', href => sprintf("%s%s", $self->dispatch_path, $item->id)),
Data::HAL::Link->new(relation => "ngcp:$type", href => sprintf("/api/%s/%s", $type, $item->id)),
Data::HAL::Link->new(relation => 'ngcp:subscribers', href => sprintf("/api/subscribers/%d", $item->id)),
+ $self->get_journal_relation_link($item->id),
],
relation => 'ngcp:'.$self->resource_name,
);
diff --git a/lib/NGCP/Panel/Role/API/Reminders.pm b/lib/NGCP/Panel/Role/API/Reminders.pm
index 87812e5d3d..ba803142fc 100644
--- a/lib/NGCP/Panel/Role/API/Reminders.pm
+++ b/lib/NGCP/Panel/Role/API/Reminders.pm
@@ -51,6 +51,7 @@ sub hal_from_item {
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:subscribers', href => sprintf("/api/subscribers/%d", $item->subscriber->voip_subscriber->id)),
+ $self->get_journal_relation_link($item->id),
],
relation => 'ngcp:'.$self->resource_name,
);
diff --git a/lib/NGCP/Panel/Role/API/SpeedDials.pm b/lib/NGCP/Panel/Role/API/SpeedDials.pm
index 3f21ab6b49..1666401609 100644
--- a/lib/NGCP/Panel/Role/API/SpeedDials.pm
+++ b/lib/NGCP/Panel/Role/API/SpeedDials.pm
@@ -43,6 +43,7 @@ sub hal_from_item {
Data::HAL::Link->new(relation => 'self', href => sprintf("%s%d", $self->dispatch_path, $item->id)),
Data::HAL::Link->new(relation => 'ngcp:speeddials', href => sprintf("/api/speeddials/%d", $item->id)),
Data::HAL::Link->new(relation => 'ngcp:subscribers', href => sprintf("/api/subscribers/%d", $item->id)),
+ $self->get_journal_relation_link($item->id),
],
relation => 'ngcp:'.$self->resource_name,
);
diff --git a/lib/NGCP/Panel/Role/API/TrustedSources.pm b/lib/NGCP/Panel/Role/API/TrustedSources.pm
index bdb083144e..c49f5419dd 100644
--- a/lib/NGCP/Panel/Role/API/TrustedSources.pm
+++ b/lib/NGCP/Panel/Role/API/TrustedSources.pm
@@ -51,6 +51,7 @@ sub hal_from_item {
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:subscribers', href => sprintf("/api/subscribers/%d", $item->subscriber->voip_subscriber->id)),
+ $self->get_journal_relation_link($item->id),
],
relation => 'ngcp:'.$self->resource_name,
);
diff --git a/lib/NGCP/Panel/Role/API/VoicemailSettings.pm b/lib/NGCP/Panel/Role/API/VoicemailSettings.pm
index 84cbedba46..f14765d006 100644
--- a/lib/NGCP/Panel/Role/API/VoicemailSettings.pm
+++ b/lib/NGCP/Panel/Role/API/VoicemailSettings.pm
@@ -49,6 +49,7 @@ sub hal_from_item {
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->provisioning_voip_subscriber->voip_subscriber->id)),
Data::HAL::Link->new(relation => 'ngcp:subscribers', href => sprintf("/api/subscribers/%d", $item->provisioning_voip_subscriber->voip_subscriber->id)),
+ $self->get_journal_relation_link($item->provisioning_voip_subscriber->voip_subscriber->id),
],
relation => 'ngcp:'.$self->resource_name,
);
diff --git a/lib/NGCP/Panel/Utils/Journal.pm b/lib/NGCP/Panel/Utils/Journal.pm
index 04b6fc0c54..925388b7c4 100644
--- a/lib/NGCP/Panel/Utils/Journal.pm
+++ b/lib/NGCP/Panel/Utils/Journal.pm
@@ -49,6 +49,8 @@ sub add_journal_item_hal {
my $arg = $args[0];
my @hal_from_item = ();
my $params;
+ my $id;
+ my $id_name = 'id';
if (ref $arg eq 'HASH') {
$params = $arg;
my $h = (defined $params->{hal} ? $params->{hal} : $params->{hal_from_item});
@@ -60,6 +62,8 @@ sub add_journal_item_hal {
@hal_from_item = ( $h );
}
}
+ $id_name = $params->{id_name} if defined $params->{id_name};
+ $id = $params->{id} if defined $params->{id};
} elsif (ref $arg eq 'ARRAY') {
$params = {};
@hal_from_item = @$arg;
@@ -86,11 +90,12 @@ sub add_journal_item_hal {
if (ref $hal eq Data::HAL::) {
$resource = $hal->resource;
}
- my $id;
- if (ref $resource eq 'HASH') {
- $id = $resource->{id};
- } elsif ((defined blessed($resource)) && $resource->can('id')) {
- $id = $resource->id;
+ if (!defined $id) {
+ if (ref $resource eq 'HASH') {
+ $id = $resource->{$id_name};
+ } elsif ((defined blessed($resource)) && $resource->can($id_name)) {
+ $id = $resource->$id_name;
+ }
}
return _create_journal($controller,$c,$id,$resource,$params);
}
diff --git a/ngcp_panel.conf b/ngcp_panel.conf
index 15ca88dfe8..416fd2a8c9 100644
--- a/ngcp_panel.conf
+++ b/ngcp_panel.conf
@@ -259,6 +259,62 @@ log4perl.appender.Default.layout.ConversionPattern=%d{ISO8601} [%p] [%F +%L] %m{
operations delete
format sereal
enabled 1
-
+
+