Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update feature/sql-index-us-radacct-id 10-30-2024 #18

Merged
merged 11 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cake4/rd_cake/config/RadiusDesk.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@
$config['icnInfoCircle']= 'xf05a@'.$config['webFont'];
$config['icnTrophy'] = 'xf091@'.$config['webFont'];
$config['icnCog'] = 'xf013@'.$config['webFont'];
$config['icnLink'] = 'xf0c1@'.$config['webFont'];
$config['icnFire'] = 'xf06d@'.$config['webFont'];
$config['icnToggleOn'] = 'xf205@'.$config['webFont'];

$config['icnBalanceScale'] = 'xf24e@'.$config['webFont'];


//=== Dynamic RADIUS Clients 23/1/17 ===
Expand Down
53 changes: 52 additions & 1 deletion cake4/rd_cake/setup/db/8.093_add_multiwan_profiles.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,66 @@ if not exists (select * from information_schema.columns
where table_name = 'multi_wan_profiles' and table_schema = 'rd') then
CREATE TABLE `multi_wan_profiles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`name` char(64) NOT NULL,
`cloud_id` int(11) DEFAULT NULL,
`last_resort` enum('unreachable','blackhole','default') DEFAULT 'unreachable',
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

end if;

if not exists (select * from information_schema.columns
where table_name = 'mwan_interfaces' and table_schema = 'rd') then
CREATE TABLE `mwan_interfaces` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`multi_wan_profile_id` int(11) DEFAULT NULL,
`name` char(64) NOT NULL,
`type` enum('ethernet','lte','wifi') DEFAULT 'ethernet',
`apply_sqm_profile` tinyint(1) NOT NULL DEFAULT 0,
`sqm_profile_id` int(11) NOT NULL DEFAULT '0',
`metric` int(11) NOT NULL DEFAULT '1',
`policy_active` tinyint(1) NOT NULL DEFAULT 0,
`policy_ratio` int(4) NOT NULL DEFAULT 1,
`policy_role` enum('active','standby') DEFAULT 'active',
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

end if;

if not exists (select * from information_schema.columns
where table_name = 'mwan_interface_settings' and table_schema = 'rd') then
CREATE TABLE `mwan_interface_settings` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`mwan_interface_id` int(11) DEFAULT NULL,
`grouping` varchar(25) DEFAULT NULL,
`type` enum('option','list') DEFAULT 'option',
`name` varchar(25) DEFAULT NULL,
`value` varchar(40) DEFAULT NULL,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

end if;


if not exists (select * from information_schema.columns where column_name = 'multi_wan_profile_id' and table_name = 'aps' and table_schema = 'rd') then
alter table aps add column multi_wan_profile_id int(11) DEFAULT NULL;
end if;

if not exists (select * from information_schema.columns where column_name = 'multi_wan_profile_id' and table_name = 'nodes' and table_schema = 'rd') then
alter table nodes add column multi_wan_profile_id int(11) DEFAULT NULL;
end if;

alter table aps modify column gateway enum('none','lan','3g','wifi','wifi_static','wifi_ppp','wifi_pppoe','wan_static','wan_ppp','wan_pppoe','mwan') DEFAULT 'none';

alter table nodes modify column gateway enum('none','lan','3g','wifi','wifi_static','wifi_ppp','wifi_pppoe','wan_static','wan_ppp','wan_pppoe', 'mwan') DEFAULT 'none';


end//

delimiter ;
Expand Down
37 changes: 33 additions & 4 deletions cake4/rd_cake/src/Controller/ApProfilesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2219,7 +2219,17 @@ public function apProfileApAdd(){
$this->{'ApConnectionSettings'}->save($ent_ws);
}
}
}
}

if($this->request->getData('internet_connection') == 'mwan'){
$d_mwan = [];
$d_mwan['ap_id'] = $new_id;
$d_mwan['grouping'] = 'mwan_setting';
$d_mwan['name'] = 'multi_wan_profile_id';
$d_mwan['value'] = $cdata["multi_wan_profile_id"];
$ent_mwan = $this->{'ApConnectionSettings'}->newEntity($d_mwan);
$this->{'ApConnectionSettings'}->save($ent_mwan);
}

if(isset($cdata['chk_no_controller'])){
$d_wbw['ap_id'] = $new_id;
Expand Down Expand Up @@ -2505,8 +2515,7 @@ public function apProfileApEdit(){

if ($this->Aps->save($apEntity)) {
$new_id = $apEntity->id;



//vlan_admin settings
$this->{'ApConnectionSettings'}->deleteAll([
'ApConnectionSettings.ap_id' => $new_id,
Expand Down Expand Up @@ -2641,7 +2650,23 @@ public function apProfileApEdit(){
$this->{'ApConnectionSettings'}->save($ent_ws);
}
}
}
}

$this->{'ApConnectionSettings'}->deleteAll([ //
'ApConnectionSettings.ap_id' => $new_id,
'ApConnectionSettings.grouping' => 'mwan_setting'
]);

if($this->request->getData('internet_connection') == 'mwan'){
$d_mwan = [];
$d_mwan['ap_id'] = $new_id;
$d_mwan['grouping'] = 'mwan_setting';
$d_mwan['name'] = 'multi_wan_profile_id';
$d_mwan['value'] = $cdata["multi_wan_profile_id"];
$ent_mwan = $this->{'ApConnectionSettings'}->newEntity($d_mwan);
$this->{'ApConnectionSettings'}->save($ent_mwan);
}


//Check if any of the reboot things are specified
$this->{'ApConnectionSettings'}->deleteAll([
Expand Down Expand Up @@ -3062,6 +3087,10 @@ public function apProfileApView(){
$data[$ws_n] = $ncs->value;
}

if($ncs->grouping == 'mwan_setting'){
$data['internet_connection'] = 'mwan';
}

if($ncs->grouping == 'vlan_setting'){
$data[$ncs->name] = intval($ncs->value);
}
Expand Down
Loading