Verified Commit a66b7715 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

🚑 fix(systems) Fix adding interfaces through webservice

issue #6039
parent e1a4e65e
......@@ -417,17 +417,25 @@ class interfacesManagement extends management implements SimpleTab
$this->listing->update();
$this->listing->setSortColumn(0, FALSE);
$entryIterator = $this->listing->getIterator();
$this->interfaces = [];
ksort($this->interfaces);
reset($this->interfaces);
foreach ($entryIterator as $entry) {
if ($this->is_template) {
$this->interfaces[$entry->dn] = objects::createTemplate($entry->getTemplatedType());
$key = key($this->interfaces);
if ($key === NULL) {
if ($this->is_template) {
$this->interfaces[$entry->dn] = objects::createTemplate($entry->getTemplatedType());
} else {
$this->interfaces[$entry->dn] = objects::create($entry->getTemplatedType());
}
$key = $entry->dn;
} else {
$this->interfaces[$entry->dn] = objects::create($entry->getTemplatedType());
next($this->interfaces);
}
$this->filter->resetFromCache($entry->dn, $this->interfaces[$entry->dn]);
$this->interfaces[$entry->dn]->getBaseObject()->base = $this->getInterfacesBase();
$this->filter->resetFromCache($entry->dn, $this->interfaces[$key]);
$this->interfaces[$key]->getBaseObject()->base = $this->getInterfacesBase();
}
/* Fill ip/mac fields of main tab */
......
......@@ -109,7 +109,7 @@ class interfacesManagementFilter extends managementFilter
$values = json_decode($networkInterface, TRUE);
}
$entryKey = ($values['dn'] ?? $values['cn'][0] ?? $values['cn']);
$entries[$entryKey] = new ListingEntry($this->parent->listing, $this->parent->objectTypes[0], ($values['dn'] ?? 'new'), $values, $row++);
$entries[$entryKey] = new ListingEntry($this->parent->listing, $this->parent->objectTypes[0], $entryKey, $values, $row++);
$entries[$entryKey]->aclBase = 'new,'.$this->parent->dn;
}
$this->entriesCache = [$entries, [$this->parent->objectTypes[0] => $row]];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment