X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=lib%2FNDWeb%2FController%2FJSRPC.pm;h=cc52d43cce9ddcec17942e3a5019f7d29508446d;hb=2c934746290ce8baa0b38425e1fd74d63a2a12f5;hp=41c7c3d6ebf4df47ce0dd08edb2159e367b99959;hpb=b1a7289bb7acbb4e911b62557acb7812492d90d5;p=ndwebbie.git diff --git a/lib/NDWeb/Controller/JSRPC.pm b/lib/NDWeb/Controller/JSRPC.pm index 41c7c3d..cc52d43 100644 --- a/lib/NDWeb/Controller/JSRPC.pm +++ b/lib/NDWeb/Controller/JSRPC.pm @@ -187,6 +187,11 @@ sub listTargets : Local { $c->forward('/listTargets'); } +sub access_denied : Private { + my ($self, $c) = @_; + $c->stash(template => 'jsrpc/access_denied.tt2'); +} + sub assertTarget : Private { my ($self, $c, $raid, $from, $target, $wave) = @_; my $dbh = $c->model; @@ -207,6 +212,16 @@ sub assertTarget : Private { sub end : ActionClass('RenderView') { my ($self,$c) = @_; $c->res->content_type('application/xml'); + + if (scalar @{ $c->error } ){ + if ($c->error->[0] =~ m/Can't call method "id" on an undefined value at/){ + $c->stash->{template} = 'jsrpc/access_denied.tt2'; + $c->clear_errors; + }elsif ($c->error->[0] =~ m/Missing roles: /){ + $c->stash->{template} = 'jsrpc/access_denied.tt2'; + $c->clear_errors; + } + } } =head1 AUTHOR