rendered paste bodysub validateTypedRow
{
my ($self, $action, $changedFields) = @_;
my @portsToCheck = ();
if ( exists $changedFields->{radiusauthport} and $action eq 'update') {
push(@portsToCheck, $changedFields->{radiusauthport}->value());
}
if ( exists $changedFields->{radiusacctport} and $action eq 'update') {
push(@portsToCheck, $changedFields->{radiusacctport}->value());
}
my $gl = EBox::Global->getInstance();
my $firewall = $gl->modInstance('firewall');
foreach my $portNumber (@portsToCheck) {
unless ( $firewall->availablePort('tcp', $portNumber) ) {
throw EBox::Exceptions::DataExists(
'data' => __('listening port'),
'value' => $portNumber,
);
}
}
}
sub formSubmitted
{
my ($self) = @_;
# Set the new port number in services module
my $authport = $self->authportValue();
my $acctport = $self->acctportValue();
my $servMod = EBox::Global->modInstance('services');
$servMod->updateDestPort( '/radius/0', $authport);
$servMod->updateDestPort( '/radius/1', $acctport);
}
my @tableHeader =
(
new EBox::Types::Port(
fieldName => 'radiusauthport',
printableName => __('RADIUS Auth port'),
editable => 1,
defaultValue => 1812,
),
new EBox::Types::Port(
fieldName => 'radiusacctport',
printableName => __('RADIUS Accounting port'),
editable => 1,
defaultValue => 1813,
),
# new EBox::Types::Boolean(
# fieldName => 'enableDir',
# printableName => __x('Enable per user {dirName}',
# dirName => PUBLIC_DIR),
# editable => 1,
# defaultValue => EBox::WebServer::Model::GeneralSettings::DefaultEnableDir(),
# ),
);