TT#139800 Enable subscriber access to /api/autoattendants/:id

* "subscriber" role can now retrieve own autoattendant data. This is needed for the CSC interface.

Change-Id: Id10b302205fe458d5793ae8f7bd9201233f9a0d4
mr10.2
Oleksandr Duts 4 years ago
parent e058a15958
commit a65d00c3a8

@ -39,7 +39,7 @@ sub journal_query_params {
__PACKAGE__->set_config({
allowed_roles => {
Default => [qw/admin reseller ccareadmin ccare subscriberadmin/],
Default => [qw/admin reseller ccareadmin ccare subscriberadmin subscriber/],
Journal => [qw/admin reseller ccareadmin ccare/],
}
});
@ -89,7 +89,7 @@ sub PUT :Allow {
my $hal = $self->hal_from_item($c, $subscriber);
last unless $self->add_update_journal_item_hal($c,{ hal => $hal, id => $subscriber->id });
$guard->commit;
$self->return_representation($c, 'hal' => $hal, 'preference' => $preference );
@ -122,7 +122,7 @@ 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 });

@ -70,8 +70,8 @@ sub _item_rs {
$item_rs = $c->model('DB')->resultset('voip_subscribers')
->search({ 'me.status' => { '!=' => 'terminated' } },
{join => 'provisioning_voip_subscriber'});
if($c->user->roles eq "admin" || $c->user->roles eq "ccareadmin") {
} elsif($c->user->roles eq "reseller" || $c->user->roles eq "ccare") {
if($c->user->roles eq "reseller" || $c->user->roles eq "ccare") {
$item_rs = $item_rs->search({
'contact.reseller_id' => $c->user->reseller_id,
}, {
@ -81,8 +81,8 @@ sub _item_rs {
$item_rs = $item_rs->search({
'provisioning_voip_subscriber.account_id' => $c->user->account_id,
});
} else {
return; # subscriber role not allowed
} elsif($c->user->roles eq "subscriber") {
$item_rs = $item_rs->search({'me.username' => $c->user->username});
}
return $item_rs;

Loading…
Cancel
Save