Доступ к рубрикам (разделам) сайта1
% my @sections = $luser->groups(); % my $sections_ = {}; % for my $secti (@sections) { % $sections_->{$secti} = 1; % my @trace = $keeper->get_section_by_id($secti)->trace(); % for my $traci (@trace) { % next if (exists $sections_->{$traci}); % $sections_->{$traci} = 1; % } % } % my @fullsections = keys(%{ $sections_ }); % my $root = $keeper->get_section_by_id(1);
    % user_sections_tree($root, \@fullsections, \@sections, 0);
Примечания
1) Доступ к секции автоматически дает доступ ко всем дочерним разделам этой секции;
<%args> $luser => undef <%init> return undef if !ref($luser); return undef unless ($luser->{attributes}->{groups}); my $root_section = $keeper->get_section_by_id($Contenido::Section::ROOT || 1); sub user_sections_tree { my ($sect, $fullsections, $sections, $depth) = @_; my $count_checked = 0; my @childs = $sect->childs(1); if ($sect->id) { my $checked = (grep {$_ == $sect->{id} } @{ $sections }) ? ' checked' : ''; $count_checked++ if( grep {$_ == $sect->{id} } @{ $fullsections } ); if (@childs && $sect->id != 1) { $m->out("{id}');\">{id}\" src=\"/contenido/i/open11x11.gif\" width=\"11\" height=\"11\" border=\"0\">"); } else { $m->out( '' ); } $m->out("{id}\" value=\"1\" $checked>"); $m->out("$sect->{name}
\n"); } if (@childs) { my $check_childs = undef; if ($depth > 0) { $m->out( ''."\n" ); } if ($check_childs > 0 && $sect->id != 1) { $m->out( "\n" ); } } return $count_checked; }