|
|
|
|
@ -5,8 +5,38 @@ sub index ( $c ) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sub people ( $c ) { |
|
|
|
|
# POST /admin |
|
|
|
|
# |
|
|
|
|
# An admin may inpersonate any other user for technical support purposes, |
|
|
|
|
# this code is called to become another user. Sign out to become your origional |
|
|
|
|
# user again. |
|
|
|
|
# |
|
|
|
|
# INPUT: |
|
|
|
|
# uid | A user id |
|
|
|
|
# bid | A blog id belonging to the user |
|
|
|
|
# |
|
|
|
|
# When given a uid, become that user and go to the user's dashboard. |
|
|
|
|
# |
|
|
|
|
# When given a uid and a bid that the user owns, become that user |
|
|
|
|
# and go to the blog's dashboard. |
|
|
|
|
# |
|
|
|
|
sub do_admin_become ( $c ) { |
|
|
|
|
my ( $uid, $bid ) = ( $c->param('uid'), $c->param('bid') ); |
|
|
|
|
|
|
|
|
|
$c->session->{oid} = $c->stash->{person}->id; |
|
|
|
|
$c->session->{uid} = $uid; |
|
|
|
|
|
|
|
|
|
# If we have a blog id, then redirect to that blog's dashboard. |
|
|
|
|
# Otherwise, the normal dashboard.. |
|
|
|
|
if ( $bid ) { |
|
|
|
|
$c->redirect_to( $c->url_for( 'show_dashboard_blog', { id => $bid } ) ); |
|
|
|
|
} else { |
|
|
|
|
$c->redirect_to( $c->url_for( 'show_dashboard' ) ); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sub people ( $c ) { |
|
|
|
|
my $people = $c->stash->{people} = [ $c->db->people->all ]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sub person ( $c ) { |
|
|
|
|
@ -14,6 +44,7 @@ sub person ( $c ) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sub blogs ( $c ) { |
|
|
|
|
my $blogs = $c->stash->{blogs} = [ $c->db->blogs->all ]; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|