TT#28453 Fix roles for config_allowed_roles inheritance entities

And add subscriber as allowed role for the pbxdevicemodels

Change-Id: Ifc373a57fcc647d83d955df80494d4a60c825db3
changes/46/18046/4
Irina Peshinskaya 7 years ago
parent 632406b006
commit 3becbebe1b

@ -52,7 +52,7 @@ __PACKAGE__->config(
action => {
map { $_ => {
ACLDetachTo => '/api/root/invalid_user',
AllowedRole => [qw/admin reseller/],
AllowedRole => [qw/admin reseller subscriberadmin subscriber/],
Args => 0,
Does => [qw(ACL CheckTrailingSlash RequireSSL)],
Method => $_,

@ -31,7 +31,7 @@ __PACKAGE__->config(
action => {
map { $_ => {
ACLDetachTo => '/api/root/invalid_user',
AllowedRole => [qw/admin reseller/],
AllowedRole => [qw/admin reseller subscriberadmin subscriber/],
Args => 1,
Does => [qw(ACL RequireSSL)],
Method => $_,

@ -425,6 +425,10 @@ sub allowed_methods_filtered {
# };
#}
sub config_allowed_roles {
return [qw/admin reseller/];
}
sub get_allowed_roles {
my($self, $method) = @_;

@ -33,7 +33,7 @@ sub relation{
sub config_allowed_roles {
return {
'Default' => [qw/admin reseller subscriberadmin/],
'Default' => [qw/admin reseller subscriberadmin subscriber/],
#GET will use default
'POST' => [qw/admin reseller/],
'PUT' => [qw/admin reseller/],
@ -61,14 +61,13 @@ sub _item_rs {
if ($c->user->roles eq "admin") {
} elsif ($c->user->roles eq "reseller") {
$item_rs = $item_rs->search({ reseller_id => $c->user->reseller_id });
} elsif ($c->user->roles eq "subscriberadmin") {
} elsif ($c->user->roles eq "subscriberadmin" || $c->user->roles eq "subscriber") {
my $reseller_id = $c->user->contract->contact->reseller_id;
return unless $reseller_id;
$item_rs = $item_rs->search({
reseller_id => $reseller_id,
});
}
return $item_rs;
}

@ -40,10 +40,6 @@ sub gather_default_action_roles {
return @roles;
}
sub config_allowed_roles {
return [qw/admin reseller/];
}
sub get {
my ($self, $c) = @_;
my $header_accept = $c->request->header('Accept');

@ -45,9 +45,6 @@ sub gather_default_action_roles {
return @roles;
}
sub config_allowed_roles {
return [qw/admin reseller/];
}
sub get {
my ($self, $c, $id) = @_;

Loading…
Cancel
Save