summaryrefslogtreecommitdiff
path: root/FS/FS/part_export/sqlradius_withdomain.pm
blob: 2af9e8d769d97645730aa4f1125d5214a8dedc40 (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
package FS::part_export::sqlradius_withdomain;

use vars qw(@ISA %info);
use Tie::IxHash;
use FS::part_export::sqlradius;

tie my %options, 'Tie::IxHash', %FS::part_export::sqlradius::options;

$options{'strip_tld'} = { type  => 'checkbox',
                          label => 'Strip TLD from realm names',
                        };

%info = (
  'svc'      => 'svc_acct',
  'desc'     => 'Real-time export to SQL-backed RADIUS (FreeRADIUS, ICRADIUS) with realms',
  'options'  => \%options,
  'nodomain' => '',
  'default_svc_class' => 'Internet',
  'notes' => $FS::part_export::sqlradius::notes1.
             'This export exports domains to RADIUS realms (see also '.
             'sqlradius).  '.
             $FS::part_export::sqlradius::notes2
);

@ISA = qw(FS::part_export::sqlradius);

sub export_username {
  my($self, $svc_acct) = (shift, shift);
  my $email = $svc_acct->email;
  if ( $self->option('strip_tld') ) {
    $email =~ s/\.\w+$//;
  }
  $email;
}

1;