[cgiapp] Re: CAP::Authorization + OO

fREW Schmidt frioux at gmail.com
Mon Mar 23 15:39:26 EDT 2009


On Mon, Mar 23, 2009 at 1:46 PM, fREW Schmidt <frioux at gmail.com> wrote:

> 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?
>


Ok, it works now.  I have no idea what I change though...  sorry about that
:-)

-- 
fREW Schmidt
http://blog.afoolishmanifesto.com


More information about the cgiapp mailing list