load_app, prefix, require_login (or role)
I am using Dancer::Plugin::Auth::Extensible but what I want is more general. I use in my app: prefix '/user' => sub { get '/' => require_login sub { my $user = logged_in_user; template 'user', { user => $user }; }; }; No problem with that. I also use in my app: load_app 'Bla', prefix => '/bla'; I would like to restrict the routes to that app to only users with a matching role. That would make "load_aps"s reuseable for other apps with a differend role mechanisem. e.g. In Bla.pm you can have: get '/request' => sub { my $req = request; reveal('request', \$req); }; In contrast to: get '/foo' => require_role($i_do_not_know_the_role) => sub { ... }; -- Henk PS: any '/logout' => sub { session->destroy; redirect '/'; }; Can be a global route for any Danser app, if there is nothing to match anymore.
participants (1)
-
Henk van Oers