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

Merge branch '6040-make-an-ipam-plugin' into '1.4-dev'

Resolve "make an ipam plugin"

See merge request fusiondirectory/fd-plugins!739
parents 6915fe17 323a3c8c
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2003-2009 GONICUS GmbH
Copyright (C) 2012 WILLIAME Jeremy
Copyright (C) 2011-2016 FusionDirectory
Copyright (C) 2011-2020 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -28,7 +29,7 @@ class freeradiusGroup extends simplePlugin
{
return [
'plShortName' => _('Freeradius'),
'plDescription' => _('This Plugin is for Radius accounting based in FreeRadius'),
'plDescription' => _('FreeRadius information'),
'plIcon' => 'geticon.php?context=applications&icon=freeradius&size=48',
'plSmallIcon' => 'geticon.php?context=applications&icon=freeradius&size=16',
'plObjectClass' => ['radiusprofile'],
......@@ -37,37 +38,26 @@ class freeradiusGroup extends simplePlugin
];
}
/*!
* \brief The main function : information about attributes
*/
static function getAttributesInfo (): array
{
return [
// Attributes are grouped by section
'section1' => [
'main' => [
'name' => _('Support 802.1x'),
'attrs' => [
new StringAttribute(
_('Tunnel medium type'),
_('Name of the tunnel medium type'),
'radiusTunnelMediumType',
TRUE,
_('Tunnel medium type'), _('Name of the tunnel medium type'),
'radiusTunnelMediumType', TRUE,
'IEEE-802'
),
new StringAttribute(
_('Tunnel type'),
_('Name of the tunnel type'),
'radiusTunnelType',
TRUE,
_('Tunnel type'), _('Name of the tunnel type'),
'radiusTunnelType', TRUE,
'VLAN'
),
new StringAttribute(
_('VLAN id'),
_('VLAN identifier'),
'radiusTunnelPrivateGroupId',
FALSE,
''
)
_('VLAN id'), _('VLAN identifier'),
'radiusTunnelPrivateGroupId', FALSE
),
]
],
];
......
......@@ -29,7 +29,7 @@ class freeradiusAccount extends simplePlugin
{
return [
'plShortName' => _('Freeradius'),
'plDescription' => _('Radius accounting based on FreeRadius'),
'plDescription' => _('FreeRadius information'),
'plFilter' => '(objectClass=radiusprofile)',
'plIcon' => 'geticon.php?context=applications&icon=freeradius&size=48',
'plSmallIcon' => 'geticon.php?context=applications&icon=freeradius&size=16',
......@@ -73,9 +73,11 @@ class freeradiusAccount extends simplePlugin
'name' => _('Groups'),
'attrs' => [
new SetAttribute(
new SelectAttribute(
new ObjectSelectAttribute(
_('Groups'), _('FreeRadius Groups'),
'radiusGroupName', FALSE
'radiusGroupName', FALSE,
['group'], 'cn', 'cn',
'(objectClass=radiusprofile)'
)
),
],
......@@ -161,22 +163,4 @@ class freeradiusAccount extends simplePlugin
],
];
}
/*!
* \brief Constructor of the freeradiusAccount
* It will build the select groups choices
*/
function __construct (string $dn = NULL, $object = NULL, $parent = NULL, bool $mainTab = FALSE)
{
global $config;
parent::__construct($dn, $object, $parent, $mainTab);
$ldap = $config->get_ldap_link();
$ldap->cd($config->current['BASE']);
$ldap->search('(&(objectClass=radiusprofile)(cn=*))', ['cn']);
$groups = [];
while ($attrs = $ldap->fetch()) {
$groups[] = $attrs['cn'][0];
}
$this->attributesAccess['radiusGroupName']->attribute->setChoices($groups);
}
}
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