Move api authentication to under command, add Authentication plugin

This commit is contained in:
Tom Bloor 2017-04-06 23:12:28 +01:00
parent f2f2a543fa
commit 998259f0ae
3 changed files with 64 additions and 34 deletions

View file

@ -0,0 +1,18 @@
package Pear::LocalLoop::Controller::Admin;
use Mojo::Base 'Mojolicious::Controller';
sub index {
my $c = shift;
}
sub under {
my $c = shift;
if ( $c->is_user_authenticated ) {
return 1 if defined $c->current_user->administrator;
}
$c->redirect_to('/');
return undef;
}
1;