source: trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Remote.pm @ 2468

Last change on this file since 2468 was 2468, checked in by nanardon, 3 years ago

Ensure anonymous request are anonymous

File size: 1.2 KB
Line 
1package LATMOS::Accounts::Web::Controller::Remote;
2use Moose;
3use namespace::autoclean;
4
5BEGIN { extends 'Catalyst::Controller'; }
6
7=head1 NAME
8
9LATMOS::Accounts::Web::Controller::Remote - Catalyst Controller
10
11=head1 DESCRIPTION
12
13Catalyst Controller.
14
15=head1 METHODS
16
17=cut
18
19sub begin : Private { }
20
21sub auto : Private {
22    my ( $self, $c ) = @_;
23
24    if ($c->user_exists) {
25        # Set login user:
26        $c->model('Accounts')->db->{_user} = $c->user->{username};
27    } else {
28        $c->model('Accounts')->db->{_user} = $c->user->{username};
29    }
30
31    return 1;
32}
33
34=head2 index
35
36=cut
37
38sub index :Path :Args(0) {
39    my ( $self, $c ) = @_;
40
41    $c->stash->{data} = {
42        LA  => $LATMOS::Accounts::VERSION,
43        LAW => $LATMOS::Accounts::Web::VERSION,
44        Remote => [
45            map { $_ =~ s/^Remote:://; $_ }
46            grep { /^Remote::/ }
47            $c->controllers
48        ],
49    };
50}
51
52sub end : Private {
53    my ( $self, $c ) = @_;
54    $c->stash->{data} ||= {};
55    $c->forward($c->view('Json'));
56}
57
58=encoding utf8
59
60=head1 AUTHOR
61
62Olivier Thauvin,Guyancourt - B1428,+33 1 80285052,
63
64=head1 LICENSE
65
66This library is free software. You can redistribute it and/or modify
67it under the same terms as Perl itself.
68
69=cut
70
71__PACKAGE__->meta->make_immutable;
72
731;
Note: See TracBrowser for help on using the repository browser.