$DEBUG = 0;
+my %groups;
tie %options, 'Tie::IxHash',
'datasrc' => { label=>'DBI data source ' },
'username' => { label=>'Database username' },
type => 'checkbox',
label => 'Show the Called-Station-ID on session reports',
},
- 'overlimit_groups' => { label => 'Radius groups to assign to svc_acct which has exceeded its bandwidth or time limit (if not overridden by overlimit_groups global or per-agent config)', } ,
+ 'overlimit_groups' => {
+ label => 'Radius groups to assign to svc_acct which has exceeded its bandwidth or time limit (if not overridden by overlimit_groups global or per-agent config)',
+ type => 'select',
+ multi => 1,
+ option_label => sub {
+ $groups{$_[0]};
+ },
+ option_values => sub {
+ %groups = (
+ map { $_->groupnum, $_->long_description }
+ qsearch('radius_group', {}),
+ );
+ sort keys (%groups);
+ },
+ } ,
'groups_susp_reason' => { label =>
'Radius group mapping to reason (via template user) (svcnum|username|username@domain reasonnum|reason)',
type => 'textarea',
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
- my $err_or_queue = $self->sqlradius_queue( $new->svcnum, 'insert',
- 'check', $self->export_username($new), $new->radius_check );
- unless ( ref($err_or_queue) ) {
- $dbh->rollback if $oldAutoCommit;
- return $err_or_queue;
+ my @newgroups = $self->suspended_usergroups($svc_acct);
+
+ unless (@newgroups) { #don't change password if assigning to a suspended group
+
+ my $err_or_queue = $self->sqlradius_queue( $new->svcnum, 'insert',
+ 'check', $self->export_username($new), $new->radius_check );
+ unless ( ref($err_or_queue) ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $err_or_queue;
+ }
+
}
- my $error;
- my (@newgroups) = $self->suspended_usergroups($svc_acct);
- $error =
+ my $error =
$self->sqlreplace_usergroups( $new->svcnum,
$self->export_username($new),
'',
- $svc_acct->usergroup,
+ [ $svc_acct->radius_groups ],
\@newgroups,
);
if ( $error ) {
$self->export_username($svc_acct),
'',
\@oldgroups,
- $svc_acct->usergroup,
+ [ $svc_acct->radius_groups ],
);
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
if (!$userspec && exists($reasonmap{$r->reason}));
}
my $suspend_user;
- if ($userspec =~ /^d+$/ ){
+ if ($userspec =~ /^\d+$/ ){
$suspend_user = qsearchs( 'svc_acct', { 'svcnum' => $userspec } );
}elsif ($userspec =~ /^\S+\@\S+$/){
my ($username,$domain) = split(/\@/, $userspec);