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

Last change on this file since 2190 was 2190, checked in by nanardon, 5 years ago

Add api to get version

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    }
28
29    return 1;
30}
31
32=head2 index
33
34=cut
35
36sub index :Path :Args(0) {
37    my ( $self, $c ) = @_;
38
39    $c->stash->{data} = {
40        LA  => $LATMOS::Accounts::VERSION,
41        LAW => $LATMOS::Accounts::Web::VERSION,
42        Remote => [
43            map { $_ =~ s/^Remote:://; $_ }
44            grep { /^Remote::/ }
45            $c->controllers
46        ],
47    };
48}
49
50sub end : Private {
51    my ( $self, $c ) = @_;
52    $c->stash->{data} ||= {};
53    $c->forward($c->view('Json'));
54}
55
56=encoding utf8
57
58=head1 AUTHOR
59
60Olivier Thauvin,Guyancourt - B1428,+33 1 80285052,
61
62=head1 LICENSE
63
64This library is free software. You can redistribute it and/or modify
65it under the same terms as Perl itself.
66
67=cut
68
69__PACKAGE__->meta->make_immutable;
70
711;
Note: See TracBrowser for help on using the repository browser.