1 |
8 |
ahitrov@rambler.ru |
<%args> |
2 |
|
|
|
3 |
|
|
$login => undef |
4 |
|
|
|
5 |
|
|
</%args> |
6 |
|
|
<%init> |
7 |
|
|
unless ($user->check_group(1)) |
8 |
|
|
{ |
9 |
|
|
$m->clear_buffer; |
10 |
|
|
$m->abort(403); |
11 |
|
|
} |
12 |
|
|
my $luser; |
13 |
|
|
if ($login) |
14 |
|
|
{ |
15 |
|
|
$luser = $keeper->get_user_by_login($login); |
16 |
|
|
|
17 |
|
|
my %sections = (); |
18 |
|
|
foreach my $name (keys %ARGS) |
19 |
|
|
{ |
20 |
|
|
if ($name =~ /^section_(\d+)$/) |
21 |
|
|
{ |
22 |
|
|
$sections{$1} = 1; |
23 |
|
|
} |
24 |
|
|
} |
25 |
|
|
my @sections_in_order = (); |
26 |
|
|
push (@sections_in_order, keys(%sections)); |
27 |
|
|
|
28 |
|
|
# Хитрый финт ушами - ибо через метод пустой выбор прав не сохраняется... |
29 |
|
|
$luser->{groups} = [@sections_in_order]; |
30 |
|
|
$luser->store(); |
31 |
|
|
|
32 |
|
|
$r->header_out("Location", "users.html?login=$login"); |
33 |
|
|
$r->status(302); |
34 |
|
|
$r->send_http_header(); |
35 |
|
|
$m->abort(); |
36 |
|
|
} |
37 |
|
|
</%init> |