[Catalyst] Re: ACL confusion

Aristotle Pagaltzis pagaltzis at gmx.de
Thu Mar 20 12:39:58 GMT 2008


* Chisel Wright <chisel at herlpacker.co.uk> [2008-03-20 11:25]:
> Unless I need more coffee, these two say different things.

They do.

> Is the only way to get OR like behaviour to use the example
> from the cookbook?

(You mean the advent entry.) No.

>    Zoo->deny_access_unless( "/moose_cage", sub {
>        my $c = shift;
>           $c->check_roles( "moose_trainer" )
>        || $c->check_roles( "moose_feeder" );
>    });

    Zoo->deny_access_unless( '/moose_cage', sub {
        shift->check_any_user_role( qw( moose_trainer moose_feeder ) );
    });

But you can write multiple rules for the same action; why not do
it that way?

    __PACKAGE__->deny_access_unless( '/books/delete', [ $_ ] )
        for qw/user admin/;

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list