Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Require login for admin pages. There's a function for that...

  • Loading branch information...
commit 06c11c94bb3101e557cfce30dde1fa1008aad349 1 parent cb44f24
@idnorton idnorton authored
Showing with 2 additions and 11 deletions.
  1. +2 −11 lib/PresentingPerl/Web/Controller/Admin.pm
View
13 lib/PresentingPerl/Web/Controller/Admin.pm
@@ -5,20 +5,11 @@ use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller::ActionRole' }
-sub root :Path :Args(0) {
+sub root :Path :Args(0) : Local Does('NeedsLogin') {
my ($self, $c) = @_;
- my $user;
-
- if($user = $c->user) {
- unless($user->get_object->has_role('admin')) {
- $c->redirect('/login');
- }
- }
-
- else {
+ unless($c->user->get_object->has_role('admin')) {
$c->redirect('/login');
-
}
my $buckets = $c->model('DB::Bucket');
Please sign in to comment.
Something went wrong with that request. Please try again.