source: LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Aliases.pm @ 641

Last change on this file since 641 was 641, checked in by nanardon, 14 years ago
  • security fix: call function checking acls for aliases
File size: 1.3 KB
Line 
1package LATMOS::Accounts::Web::Controller::Aliases;
2
3use strict;
4use warnings;
5use base 'LATMOS::Accounts::Web::Controller';
6
7=head1 NAME
8
9LATMOS::Accounts::Web::Controller::Aliases - Catalyst Controller
10
11=head1 DESCRIPTION
12
13Catalyst Controller.
14
15=head1 METHODS
16
17=cut
18
19
20=head2 index
21
22=cut
23
24sub index :Path :Args(0) {
25    my ( $self, $c ) = @_;
26
27    my $db = $c->model('Accounts')->db;
28    my @al = $c->req->param('al');
29    my @name = $c->req->param('name');
30    my @forward = $c->req->param('forward');
31    foreach my $idx (0 .. scalar(@name) - 1) {
32
33        if ($c->req->param('del' . ($idx+1))) {
34            $db->delete_object('aliases', $al[$idx]);
35        } elsif ($al[$idx] ne $name[$idx]) {
36            # delete old, create new
37            $db->delete_c_object('aliases', $al[$idx]) if($al[$idx]);
38            $db->create_c_object('aliases', $name[$idx],
39                forward => [ split(/\s*,\s*/, $forward[$idx]) ],
40            );
41        } else {
42            my $obj = $db->get_object('aliases', $al[$idx]);
43            $obj->set_c_fields(
44                'forward' => [ split(/\s*,\s*/, $forward[$idx]) ],
45            );
46        }
47    }
48
49    $db->commit;
50}
51
52
53=head1 AUTHOR
54
55Olivier Thauvin
56
57=head1 LICENSE
58
59This library is free software. You can redistribute it and/or modify
60it under the same terms as Perl itself.
61
62=cut
63
641;
Note: See TracBrowser for help on using the repository browser.