summaryrefslogtreecommitdiff
path: root/httemplate/browse/radius_group.html
blob: 98e81ab86d50ff55f90ec8c5d03233622cd631d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<& elements/browse.html,
  'title'       => 'RADIUS Groups',
  'name'        => 'RADIUS Groups',
  'menubar'     => [ 'Add a RADIUS Group' => $p.'edit/radius_group.html', ],
  'query'       => { 'table' => 'radius_group' },
  'count_query' => 'SELECT COUNT(*) FROM radius_group',
  'header'      => [ '#', 'RADIUS Group', 'Description', 'Priority',
                     'Check', 'Reply', 'Speed' ],
  'fields'      => [ 'groupnum',
                     'groupname',
                     'description',
                     'priority',
                     $check_attr, $reply_attr,
                     sub { 
                      my $group = shift;
                      if ($group->speed_down and $group->speed_up) {
                        return join (' / ', $group->speed_down, $group->speed_up);
                      } elsif ( $group->speed_down ) {
                        return $group->speed_down . ' down';
                      } elsif ( $group->speed_up ) {
                        return $group->speed_up . ' up';
                      }
                      '';
                     },
                   ],
  'align'       => 'lllcllc',
  'links'       => [ $link, $link, '', '', '', '', ''
                   ],
&>
<%init>

my $curuser = $FS::CurrentUser::CurrentUser;

die "access denied"
  unless $curuser->access_right('Configuration');

my $attr_sub = sub {
  my $type = shift;
  my $radius_group = shift;
  [ map { [ { data => join(' ', $_->attrname, $_->op, $_->value) } ] }
    grep {$_->attrtype eq $type} 
      $radius_group->radius_attr
  ];
};

my $check_attr = sub { &$attr_sub('C', @_) };
my $reply_attr = sub { &$attr_sub('R', @_) };

my $link = [ $p.'edit/radius_group.html?', 'groupnum' ];

</%init>