[cgiapp] CAP::Authorization + OO
fREW Schmidt
frioux at gmail.com
Mon Mar 23 14:46:29 EDT 2009
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
More information about the cgiapp
mailing list