mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 11:26:13 +00:00
VPN: WireGuard: Peers - unlink instance on delete
This commit is contained in:
parent
ed1d8a6260
commit
a8e329b905
@ -86,6 +86,17 @@ class ClientController extends ApiMutableModelControllerBase
|
||||
|
||||
public function delClientAction($uuid)
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
Config::getInstance()->lock();
|
||||
$mdl = new Server();
|
||||
foreach ($mdl->servers->server->iterateItems() as $key => $node) {
|
||||
$peers = array_filter(explode(',', (string)$node->peers));
|
||||
if (in_array($uuid, $peers)) {
|
||||
$node->peers = implode(',', array_diff($peers, [$uuid]));
|
||||
}
|
||||
}
|
||||
$mdl->serializeToConfig(false, true);
|
||||
}
|
||||
return $this->delBase('clients.client', $uuid);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user