]> ruin.nu Git - ndwebbie.git/blobdiff - lib/NDWeb/Controller/JSRPC.pm
Use status 403 for access denied
[ndwebbie.git] / lib / NDWeb / Controller / JSRPC.pm
index cc52d43cce9ddcec17942e3a5019f7d29508446d..5515a2aecfa824fec3c5e4703b8855ce1be477f8 100644 (file)
@@ -190,6 +190,7 @@ sub listTargets : Local {
 sub access_denied : Private {
        my ($self, $c) = @_;
        $c->stash(template => 'jsrpc/access_denied.tt2');
+       $c->res->status(403);
 }
 
 sub assertTarget : Private {
@@ -216,9 +217,11 @@ sub end : ActionClass('RenderView') {
        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->res->status(403);
                        $c->clear_errors;
                }elsif ($c->error->[0] =~ m/Missing roles: /){
                        $c->stash->{template} = 'jsrpc/access_denied.tt2';
+                       $c->res->status(403);
                        $c->clear_errors;
                }
        }