[Catalyst] configuring plugin's
    Dermot 
    paikkos at googlemail.com
       
    Mon Jun 30 19:33:47 BST 2008
    
    
  
Hi,
I seem to be struggling with the configuring of plugins, in this case
Authorization::Roles.
I have the following in lib/MyApp.pm
__PACKAGE__->setup(qw/-Debug
                        ConfigLoader
                        Static::Simple
                        StackTrace
                        Authentication
                        Authorization::Roles
                        Session::State
                        Session::Store
                        Session::Store::FastMmap
                        Session
                        /);
and MyApp.yml has
name: MyApp
Model::MyAppDB:
  connect_info:
    - DBI:SQLite:__HOME__/MyApp.db
Authentication:
 default_realm: user
 realms:
  user:
   credential:
    class: Password
    password_field: password
    password_type: clear
   store:
    class: DBIx::Class
    user_class: UsersRoles
    role_relation: role_id
    role_field: role
I think that all the above is correctly configured. The grapping void
in my understanding is making the schema available in my methods. So
sub list : Local {
  my ($self, $c) = @_;
  print STDERR "login=",$c->check_roles('admin'),"\n";
  $c->detach('denied') unless $c->check_roles('admin');
  $c->stash->{stuff} = [$c->model('MyAppDB::Stuff')->all];
  $c->stash->{template} = 'submissions/list.tt2
}
Give me the error:
Can't locate object method "asser_user_roles" via package "MyApp
because I can't figure out how to use Authorization::Roles within my
class methods.
use base qw(Catalyst::Controller::HTML::FormFu
                Catalyst::Plugin::Authorization::Roles
            );
The above doesn't work and I would have thought that I wouldn't need
to include with a use base when it's loaded via MyApp.pm.
Any clues? TIA.
Dp.
    
    
More information about the Catalyst
mailing list