diff --git a/lib/NGCP/Panel/Controller/API/AutoAttendantsItem.pm b/lib/NGCP/Panel/Controller/API/AutoAttendantsItem.pm index 7b085ebe31..6235d5aae3 100644 --- a/lib/NGCP/Panel/Controller/API/AutoAttendantsItem.pm +++ b/lib/NGCP/Panel/Controller/API/AutoAttendantsItem.pm @@ -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 }); diff --git a/lib/NGCP/Panel/Role/API/AutoAttendants.pm b/lib/NGCP/Panel/Role/API/AutoAttendants.pm index 02ff077d4a..77c6d149c6 100644 --- a/lib/NGCP/Panel/Role/API/AutoAttendants.pm +++ b/lib/NGCP/Panel/Role/API/AutoAttendants.pm @@ -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;