diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d97ddf..f6fd5ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog -## [1.7.0] - 2026-84-28 + +## [1.7.1] - 2026-05-04 +### Fixed +- Corregido bug en la propagación de parametros de las OU, se propagaban parametros de hijos a padres. +- Corregido también bug en la propagación de la interfaz de red a los clientes de una OU + +## [1.7.0] - 2026-04-28 ### Added - Añadido endpoint para consultar y mostrar versiones de los distintos paquetes de Opengnsys - Sondeo del estado de las aulas diff --git a/src/Controller/PropagateNetworkSettingsAction.php b/src/Controller/PropagateNetworkSettingsAction.php index 6e79ba9..0a41156 100644 --- a/src/Controller/PropagateNetworkSettingsAction.php +++ b/src/Controller/PropagateNetworkSettingsAction.php @@ -48,7 +48,8 @@ class PropagateNetworkSettingsAction extends AbstractController $client->setBootServer($networkSettings->getBootServer()); $client->setOgLive($networkSettings->getOgLive()); $client->setTemplate($networkSettings->getPxeTemplate()); - $client->setEthernet($networkSettings->getEthernet()); + $client->setResolution($networkSettings->getResolution()); + $client->setNetiface($networkSettings->getNetiface()); } $this->entityManager->flush(); diff --git a/src/Entity/AbstractEntity.php b/src/Entity/AbstractEntity.php index b4d7cba..385524e 100644 --- a/src/Entity/AbstractEntity.php +++ b/src/Entity/AbstractEntity.php @@ -34,6 +34,12 @@ abstract class AbstractEntity $this->uuid = Uuid::uuid7(); } + public function __clone() + { + $this->id = null; + $this->uuid = Uuid::uuid7(); + } + public function getId(): ?int { return $this->id; diff --git a/src/Entity/NetworkSettings.php b/src/Entity/NetworkSettings.php index 86a6747..66570ed 100644 --- a/src/Entity/NetworkSettings.php +++ b/src/Entity/NetworkSettings.php @@ -93,6 +93,38 @@ class NetworkSettings extends AbstractEntity $this->organizationalUnits = new ArrayCollection(); } + public function __clone() + { + parent::__clone(); + $this->organizationalUnits = new ArrayCollection(); + } + + public function copyFrom(NetworkSettings $source): void + { + $this->nextServer = $source->getNextServer(); + $this->bootFileName = $source->getBootFileName(); + $this->proxy = $source->getProxy(); + $this->dns = $source->getDns(); + $this->netmask = $source->getNetmask(); + $this->router = $source->getRouter(); + $this->ntp = $source->getNtp(); + $this->netiface = $source->getNetiface(); + $this->p2pTime = $source->getP2pTime(); + $this->p2pMode = $source->getP2pMode(); + $this->mcastIp = $source->getMcastIp(); + $this->mcastSpeed = $source->getMcastSpeed(); + $this->mcastMode = $source->getMcastMode(); + $this->mcastPort = $source->getMcastPort(); + $this->resolution = $source->getResolution(); + $this->menu = $source->getMenu(); + $this->hardwareProfile = $source->getHardwareProfile(); + $this->repository = $source->getRepository(); + $this->ogLive = $source->getOgLive(); + $this->ogShare = $source->getOgShare(); + $this->pxeTemplate = $source->getPxeTemplate(); + $this->bootServer = $source->getBootServer(); + } + public function getNextServer(): ?string { return $this->nextServer; diff --git a/src/Entity/OrganizationalUnit.php b/src/Entity/OrganizationalUnit.php index d776214..2178124 100644 --- a/src/Entity/OrganizationalUnit.php +++ b/src/Entity/OrganizationalUnit.php @@ -335,17 +335,29 @@ class OrganizationalUnit extends AbstractEntity public function updateNetworkSettingsRecursively(?NetworkSettings $networkSettings): void { - $this->setNetworkSettings($networkSettings); + if ($networkSettings === null) { + $this->setNetworkSettings(null); + } else { + $currentSettings = $this->getNetworkSettings(); + if ($currentSettings === null || $currentSettings === $networkSettings) { + $this->setNetworkSettings(clone $networkSettings); + } else { + $currentSettings->copyFrom($networkSettings); + } + } - /** @var Client $client */ - foreach ($this->getClients() as $client) { - $client->setMenu($networkSettings->getMenu()); - $client->setHardwareProfile($networkSettings->getHardwareProfile()); - $client->setRepository($networkSettings->getRepository()); - $client->setBootServer($networkSettings->getBootServer()); - $client->setOgLive($networkSettings->getOgLive()); - $client->setTemplate($networkSettings->getPxeTemplate()); - $client->setResolution($networkSettings->getResolution()); + if ($networkSettings !== null) { + /** @var Client $client */ + foreach ($this->getClients() as $client) { + $client->setMenu($networkSettings->getMenu()); + $client->setHardwareProfile($networkSettings->getHardwareProfile()); + $client->setRepository($networkSettings->getRepository()); + $client->setBootServer($networkSettings->getBootServer()); + $client->setOgLive($networkSettings->getOgLive()); + $client->setTemplate($networkSettings->getPxeTemplate()); + $client->setResolution($networkSettings->getResolution()); + $client->setNetiface($networkSettings->getNetiface()); + } } foreach ($this->getOrganizationalUnits() as $childUnit) {