1 # Copyright (C) 2002 Stanislav Sinyagin
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17 # $Id: Export.pm,v 1.1 2010-12-27 00:03:59 ivan Exp $
18 # Stanislav Sinyagin <ssinyagin@yahoo.com>
21 package Torrus::ACL::Export;
24 use Torrus::ACL::Edit;
35 my $exportfile = shift;
36 my $exporttemplate = shift;
38 my $tt = new Template(INCLUDE_PATH => $Torrus::Global::templateDirs,
42 'groups' => sub { return $self->listGroups(); },
43 'users' => sub { return $self->listUsers(); },
44 'memberof' => sub { return $self->memberOf($_[0]); },
45 'uattrlist' => sub { return $self->listUserAttributes($_[0]); },
46 'uattr' => sub { return $self->userAttribute($_[0], $_[1]); },
47 'gattrlist' => sub { return $self->listGroupAttributes($_[0]); },
48 'gattr' => sub { return $self->groupAttribute($_[0], $_[1]); },
49 'privileges' => sub { return $self->listPrivileges($_[0]); },
50 'version' => $Torrus::Global::version,
51 'xmlnorm' => \&xmlnormalize
54 my $ok = $tt->process($exporttemplate, $vars, $exportfile);
58 print STDERR "Error while processing template: ".$tt->error()."\n";
62 Info('Wrote ' . $exportfile);
73 $txt =~ s/\&/\&\;/gm;
74 $txt =~ s/\</\<\;/gm;
75 $txt =~ s/\>/\>\;/gm;
76 $txt =~ s/\'/\&apos\;/gm;
77 $txt =~ s/\"/\"\;/gm;
89 # indent-tabs-mode: nil
90 # perl-indent-level: 4