export negative byte values to chillispot attributes as 0, RT#5815
[freeside.git] / httemplate / browse / access_group.html
1 <% include( 'elements/browse.html',
2                  'title'       => 'Internal Access Groups',
3                  'menubar'     => [ 'Internal users' => $p.'browse/access_user.html', ],
4                  'html_init'   => $html_init,
5                  'name'        => 'internal access groups',
6                  'query'       => { 'table'     => 'access_group',
7                                     'hashref'   => {},
8                                     'extra_sql' => 'ORDER BY groupname', #??
9                                   },
10                  'count_query' => $count_query,
11                  'header'      => [ '#',
12                                     'Group name',
13                                     'Agents',
14                                     'Rights',
15                                   ],
16                  'fields'      => [ 'groupnum',
17                                     'groupname',
18                                     $agents_sub,
19                                     $rights_sub,
20                                   ],
21                  'links'       => [ $link,
22                                     $link,
23                                     '',
24                                     '',
25                                   ],
26              )
27 %>
28 <%init>
29
30 die "access denied"
31   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
32
33 my $html_init = 
34   "Internal access groups control access to the back-office interface.<BR><BR>".
35   qq!<A HREF="${p}edit/access_group.html"><I>Add an internal access group</I></A><BR><BR>!;
36
37 #false laziness w/access_user.html & agent_type.cgi
38 my $agents_sub = sub {
39   my $access_group = shift;
40
41   [ map {
42           my $access_groupagent = $_;
43           my $agent = $access_groupagent->agent;
44           [
45             {
46               'data'  => $agent->agent,
47               'align' => 'left',
48               'link'  => $p. 'edit/agent.cgi?'. $agent->agentnum,
49             },
50           ];
51         }
52     grep { $_->agent } #?
53     $access_group->access_groupagent,
54
55   ];
56   
57 };
58
59 my $rights_sub = sub {
60   my $access_group = shift;
61
62   [ map { my $access_right = $_;
63           [
64             { 
65               'data'  => $access_right->rightname,
66               'align' => 'left',
67             },
68           ];
69         }
70     $access_group->access_rights,
71
72   ];
73
74 };
75
76 my $count_query = 'SELECT COUNT(*) FROM access_group';
77
78 my $link = [ $p.'edit/access_group.html?', 'groupnum' ];
79
80 </%init>