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

Merge branch '6039-update-the-system-plugin' into '1.4-dev'

Resolve "update the system plugin"

See merge request fusiondirectory/fd-plugins!754
parents 0f03fc4f 8c7f4fd5
......@@ -22,12 +22,14 @@
/*!
* \brief Fake attribute class which is used to allow editing interfaces through templates or webservice
*/
class InterfacesAttribute extends Attribute
class InterfacesAttribute extends DialogOrderedArrayAttribute
{
function __construct (string $label, string $description, string $ldapName, bool $required = FALSE, $defaultValue = '', string $acl = '')
{
parent::__construct($label, $description, $ldapName, $required, $defaultValue, $acl);
Attribute::__construct($label, $description, $ldapName, $required, $defaultValue, $acl);
$this->setInLdap(FALSE);
$this->edit_enabled = TRUE;
$this->attribute = FALSE;
}
function setParent (&$plugin)
......@@ -57,4 +59,47 @@ class InterfacesAttribute extends Attribute
{
return $this->plugin->filter->loadTemplateValues($value);
}
protected function getAttributeArrayValue ($key, $value)
{
/* FIXME Convert text value to displayable array value */
die('Pure virtual method');
}
function addValue (string $dn, $attrs = NULL)
{
/* FIXME */
if ($attrs !== NULL) {
$this->value[] = $attrs;
$this->reIndexValues();
}
}
protected function handleEdit ($key)
{
/* FIXME */
$this->editingValue = $this->value[$key];
$this->delPostValue($key);
$this->plugin->openDialog(new $this->dialogClass($this->plugin, $this, $this->editingValue));
}
/* readValue/writeValue? */
function computeLdapValue ()
{
throw new FusionDirectoryError('computeLdapValue should not be called on InterfacesAttribute');
}
protected function sortValues ()
{
}
protected function reIndexValues ()
{
}
function foreignKeyUpdate ($oldvalue, $newvalue, array $source)
{
throw new FusionDirectoryError('foreignKeyUpdate should not be called on InterfacesAttribute');
}
}
......@@ -108,8 +108,9 @@ class interfacesManagementFilter extends managementFilter
} else {
$values = json_decode($networkInterface, TRUE);
}
$entries[$values['dn']] = new ListingEntry($this->parent->listing, $this->parent->objectTypes[0], $values['dn'], $values, $row++);
$entries[$values['dn']]->aclBase = 'new,'.$this->parent->dn;
$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]->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