4 use FS::UID qw(adminsuidsetup);
5 use FS::Record qw(qsearch);
9 &untaint_argv; #what it sounds like (eww)
11 my($user, $action, $groupname, $svcpart) = @ARGV;
15 my @svc_acct = map { $_->svc_x } qsearch('cust_svc', { svcpart => $svcpart } );
17 if ( lc($action) eq 'add' ) {
18 foreach my $svc_acct ( @svc_acct ) {
19 my @groups = $svc_acct->radius_groups;
20 next if grep { $_ eq $groupname } @groups;
21 push @groups, $groupname;
22 my %hash = $svc_acct->hash;
23 $hash{usergroup} = \@groups;
24 my $new = new FS::svc_acct \%hash;
25 my $error = $new->replace($svc_acct);
35 foreach $_ ( $[ .. $#ARGV ) { #untaint @ARGV
36 $ARGV[$_] =~ /^(.*)$/ || die "Illegal arguement \"$ARGV[$_]\"";
42 die "Usage:\n\n freeside-radgroup user action groupname svcpart\n";
47 freeside-radgroup - Command line utility to manipulate radius groups
51 freeside-addgroup user action groupname svcpart
55 B<user> is a freeside user as added with freeside-adduser.
57 B<command> is the action to take. Available actions are: I<add>
59 B<groupname> is the group to add (or remove, etc.)
61 B<svcpart> specifies which accounts will be updated.
65 freeside-radgroup freesideuser add groupname 3
67 Adds I<groupname> to all accounts with service definition 3.
73 L<freeside-adduser>, L<FS::svc_acct>, L<FS::part_svc>