Using Dancer::Plugin::Auth::Extensible with Dancer::Plugin::REST
I already use the Dancer::Plugin::Auth::Extensible (which is very nice, thanks!) to protect my routes. I would like to be able to protect the routes generated with the resources keyword. I tried something like: resource user => get => sub { }, delete => require_role Admin => sub { }, ... Won't work. D:P:Auth::Extensible seems to call the coderef passed to it. I guess I would need the coderef returned? Any hint? Thanks! -- Jacques Lareau
On 13-12-10 10:00 PM, Jacques Lareau wrote:
resource user => get => sub { }, delete => require_role Admin => sub { }, ...
I'll go on a limb, but just for giggles, try: resource user => get => sub { }, delete => require_role( Admin => sub { } ), ... What I suspect is happening is that 'require_role' slurps all the remaining arguments, which makes resource sad. But that's just a hunch, I could be wrong... Joy, `/anick
It's working great. Thanks! On Tue, Dec 10, 2013 at 10:54 PM, Yanick Champoux <yanick@babyl.dyndns.org>wrote:
On 13-12-10 10:00 PM, Jacques Lareau wrote:
resource user => get => sub { }, delete => require_role Admin => sub { }, ...
I'll go on a limb, but just for giggles, try:
resource user => get => sub { }, delete => require_role( Admin => sub { } ), ...
What I suspect is happening is that 'require_role' slurps all the remaining arguments, which makes resource sad. But that's just a hunch, I could be wrong...
Joy, `/anick
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
participants (2)
-
Jacques Lareau -
Yanick Champoux