|
|
@ -829,7 +829,12 @@ sub update_item {
|
|
|
|
sub check_write_access {
|
|
|
|
sub check_write_access {
|
|
|
|
my($self, $c) = @_;
|
|
|
|
my($self, $c) = @_;
|
|
|
|
if($c->user->roles eq "admin" || $c->user->roles eq "reseller") {
|
|
|
|
if($c->user->roles eq "admin" || $c->user->roles eq "reseller") {
|
|
|
|
} elsif($c->user->roles eq "subscriber") {
|
|
|
|
} elsif($c->user->roles eq "subscriber"
|
|
|
|
|
|
|
|
|| (
|
|
|
|
|
|
|
|
$c->user->roles eq "subscriberadmin"
|
|
|
|
|
|
|
|
&& !$self->subscriberadmin_write_access($c)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
) {
|
|
|
|
$self->error($c, HTTP_FORBIDDEN, "Read-only resource for authenticated role");
|
|
|
|
$self->error($c, HTTP_FORBIDDEN, "Read-only resource for authenticated role");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
} elsif($c->user->roles eq "subscriberadmin") {
|
|
|
|
} elsif($c->user->roles eq "subscriberadmin") {
|
|
|
@ -848,8 +853,8 @@ sub check_write_access {
|
|
|
|
|
|
|
|
|
|
|
|
sub subscriberadmin_write_access {
|
|
|
|
sub subscriberadmin_write_access {
|
|
|
|
my($self,$c) = @_;
|
|
|
|
my($self,$c) = @_;
|
|
|
|
if ($c->user->roles eq "subscriberadmin"
|
|
|
|
if ($c->user->roles eq "subscriberadmin"
|
|
|
|
&& $c->config->{privileges}->{subscriberadmin}->{subscribers}
|
|
|
|
&& $c->config->{privileges}->{subscriberadmin}->{subscribers}
|
|
|
|
&& $c->config->{privileges}->{subscriberadmin}->{subscribers} =~/write/ ) {
|
|
|
|
&& $c->config->{privileges}->{subscriberadmin}->{subscribers} =~/write/ ) {
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|