View | Details | Raw Unified | Return to bug 13632
Collapse All | Expand All

(-)a/build_permissions_file.pl (-1 / +22 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
use Modern::Perl;
4
use C4::Context;
5
my $dbh = C4::Context->dbh;
6
7
my $flags = $dbh->selectall_arrayref(q|SELECT * FROM userflags|, { Slice => {} });
8
my $permissions = $dbh->selectall_arrayref(q|SELECT * FROM permissions|, { Slice => {} });
9
10
my $content = qq|[%- BLOCK main_permissions -%]\n    [% SWITCH name %]\n|;
11
for my $f ( @$flags ) {
12
    $content .= q|    [%- CASE '| . $f->{flag} . q|' -%]<span>| . $f->{flagdesc} . qq|</span>\n|;
13
}
14
$content .= qq|    [%- END -%]\n[%- END -%]\n\n|;
15
16
$content .= qq|[%- BLOCK sub_permissions -%]\n    [% SWITCH name %]\n|;
17
for my $p ( @$permissions ) {
18
    $content .= qq|    [%- CASE '| . $p->{code} . q|' -%]<span>| . $p->{description} . qq|</span>\n|;
19
}
20
$content .= qq|    [%- END -%]\n[%- END -%]|;
21
22
say $content;

Return to bug 13632