Hello all!
I am trying to use CAP::Authz and I can't seem to get it to use the
FORBIDDEN_RUNMODE,

Here is a relevant snippet:

sub cgiapp_init {
   my $self = shift;
   ...

   $self->authz->config(
      FORBIDDEN_RUNMODE => 'missing_role',
      DRIVER => [ 'Generic', sub {
         return undef;
      },
      ],
   );

}

__PACKAGE__->authz->authz_runmodes(
   [main => 'testgroup'],
);

sub setup {
   my $self = shift;
   $self->run_modes([ qw/need_login missing_role/ ]);
}

sub need_login : Runmode {
    my $self = shift;
    $self->header_add( -status => '500 unauthenticated' );
    return $self->json_body({ success => 'false', reason =>
'unauthenticated'});
}

sub missing_role : Runmode {
    my $self = shift;
    $self->header_add( -status => '500 unauthorized' );
    return $self->json_body({ success => 'false', reason =>
'unauthorized'});
}

Yet when I try to use main I still get the default forbidden runmode, "
Forbidden
You do not have permission to perform that action"

Does anyone see what I am doing wrong?

Thanks either way!
-- 
fREW Schmidt
http://blog.afoolishmanifesto.com

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################

Reply via email to