[Dancer-users] Dancer::Plugin::Auth::RBAC Application

Forgoselo Fontardion fontardion at gmail.com
Thu Apr 14 18:53:59 CEST 2011


Hi,

I'm startirng to create a new web application, my first dancer's one.

I'm testing the RBAC plugin. I've found a problem that I can't solve. When I
try to use a function to check the status of the login, in example to check
if a user has admin role or to revoke its permissions. In the cases
previously described I found an error, because the $auth scalar variable is
only accessible to the route '/'.

get '/' => sub {
  if $auth->asa('guest') ) {
    redirect '/login';
  }
  else {
    template 'index';
  }
};

post '/login' => sub {
    my $auth = auth(params->{username}, params->{password});
    if (! $auth->errors) {
      flash ok => 'Login ok';
      redirect '/';
    }
    else {
      flash error => 'Login Error';
      redirect '/login';
    }

};

get '/logout' => sub {
    $auth->revoke();
    flash ok => 'Session Closed';
    redirect '/';
};

Best regards,
                       Fontardion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20110414/16530a0e/attachment.htm>


More information about the Dancer-users mailing list