2 package SGN
::Controller
::AJAX
::Login
;
7 BEGIN { extends
'Catalyst::Controller::REST' }
10 default => 'application/json',
12 map => { 'application/json' => 'JSON', 'text/html' => 'JSON' },
16 sub is_logged_in
:Path
('/user/logged_in') Args
(0) {
20 if (my $user = $c->user()) {
21 my $user_id = $user->get_object->get_sp_person_id();
22 $c->stash->{rest
} = { user_id
=> $user_id };
25 $c->stash->{rest
} = { user_id
=> 0 };
28 sub get_roles
:Path
('/user/get_roles') Args
(0) {
32 if (my $user = $c->user()) {
33 my @roles = $user->get_object->get_roles();
34 $c->stash->{rest
} = { roles
=> @roles };
37 $c->stash->{rest
} = { roles
=> 0 };
40 sub log_in
:Path
('/user/login') Args
(0) {
44 my $login = CXGN
::Login
->new();
50 sub log_out
:Path
('/user/logout') Args
(0) {