|
|
|
@ -21,7 +21,7 @@ sub item_rs {
|
|
|
|
|
my $item_rs = $c->model('DB')->resultset('email_templates');
|
|
|
|
|
if($c->user->roles eq "admin") {
|
|
|
|
|
} elsif($c->user->roles eq "reseller") {
|
|
|
|
|
$item_rs = $item_rs->search({ reseller_id => $c->user->reseller_id });
|
|
|
|
|
$item_rs = $item_rs->search({ reseller_id => $c->user->reseller_id },{prefetch=>'reseller'});
|
|
|
|
|
}
|
|
|
|
|
return $item_rs;
|
|
|
|
|
}
|
|
|
|
@ -50,7 +50,7 @@ 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:resellers', href => sprintf("/api/resellers/%d", $item->reseller_id)),
|
|
|
|
|
$item->reseller_id ? Data::HAL::Link->new(relation => 'ngcp:resellers', href => sprintf("/api/resellers/%d", $item->reseller_id)):(),
|
|
|
|
|
],
|
|
|
|
|
relation => 'ngcp:'.$self->resource_name,
|
|
|
|
|
);
|
|
|
|
|