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
|
Rev | Line | |
---|
[516] | 1 | package LATMOS::Accounts::Web::Controller::Aliases; |
---|
| 2 | |
---|
| 3 | use strict; |
---|
| 4 | use warnings; |
---|
| 5 | use base 'LATMOS::Accounts::Web::Controller'; |
---|
| 6 | |
---|
| 7 | =head1 NAME |
---|
| 8 | |
---|
| 9 | LATMOS::Accounts::Web::Controller::Aliases - Catalyst Controller |
---|
| 10 | |
---|
| 11 | =head1 DESCRIPTION |
---|
| 12 | |
---|
| 13 | Catalyst Controller. |
---|
| 14 | |
---|
| 15 | =head1 METHODS |
---|
| 16 | |
---|
| 17 | =cut |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | =head2 index |
---|
| 21 | |
---|
| 22 | =cut |
---|
| 23 | |
---|
| 24 | sub 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'); |
---|
[518] | 31 | foreach my $idx (0 .. scalar(@name) - 1) { |
---|
[516] | 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 |
---|
[641] | 37 | $db->delete_c_object('aliases', $al[$idx]) if($al[$idx]); |
---|
| 38 | $db->create_c_object('aliases', $name[$idx], |
---|
[516] | 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 | |
---|
| 55 | Olivier Thauvin |
---|
| 56 | |
---|
| 57 | =head1 LICENSE |
---|
| 58 | |
---|
| 59 | This library is free software. You can redistribute it and/or modify |
---|
| 60 | it under the same terms as Perl itself. |
---|
| 61 | |
---|
| 62 | =cut |
---|
| 63 | |
---|
| 64 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.