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 <?php
/* /*
This code is part of FusionDirectory (http://www.fusiondirectory.org/) This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2003-2009 GONICUS GmbH Copyright (C) 2003-2009 GONICUS GmbH
Copyright (C) 2012 WILLIAME Jeremy 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 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 it under the terms of the GNU General Public License as published by
...@@ -28,7 +29,7 @@ class freeradiusGroup extends simplePlugin ...@@ -28,7 +29,7 @@ class freeradiusGroup extends simplePlugin
{ {
return [ return [
'plShortName' => _('Freeradius'), 'plShortName' => _('Freeradius'),
'plDescription' => _('This Plugin is for Radius accounting based in FreeRadius'), 'plDescription' => _('FreeRadius information'),
'plIcon' => 'geticon.php?context=applications&icon=freeradius&size=48', 'plIcon' => 'geticon.php?context=applications&icon=freeradius&size=48',
'plSmallIcon' => 'geticon.php?context=applications&icon=freeradius&size=16', 'plSmallIcon' => 'geticon.php?context=applications&icon=freeradius&size=16',
'plObjectClass' => ['radiusprofile'], 'plObjectClass' => ['radiusprofile'],
...@@ -37,37 +38,26 @@ class freeradiusGroup extends simplePlugin ...@@ -37,37 +38,26 @@ class freeradiusGroup extends simplePlugin
]; ];
} }
/*!
* \brief The main function : information about attributes
*/
static function getAttributesInfo (): array static function getAttributesInfo (): array
{ {
return [ return [
// Attributes are grouped by section 'main' => [
'section1' => [
'name' => _('Support 802.1x'), 'name' => _('Support 802.1x'),
'attrs' => [ 'attrs' => [
new StringAttribute( new StringAttribute(
_('Tunnel medium type'), _('Tunnel medium type'), _('Name of the tunnel medium type'),
_('Name of the tunnel medium type'), 'radiusTunnelMediumType', TRUE,
'radiusTunnelMediumType',
TRUE,
'IEEE-802' 'IEEE-802'
), ),
new StringAttribute( new StringAttribute(
_('Tunnel type'), _('Tunnel type'), _('Name of the tunnel type'),
_('Name of the tunnel type'), 'radiusTunnelType', TRUE,
'radiusTunnelType',
TRUE,
'VLAN' 'VLAN'
), ),
new StringAttribute( new StringAttribute(
_('VLAN id'), _('VLAN id'), _('VLAN identifier'),
_('VLAN identifier'), 'radiusTunnelPrivateGroupId', FALSE
'radiusTunnelPrivateGroupId', ),
FALSE,
''
)
] ]
], ],
]; ];
......
...@@ -29,7 +29,7 @@ class freeradiusAccount extends simplePlugin ...@@ -29,7 +29,7 @@ class freeradiusAccount extends simplePlugin
{ {
return [ return [
'plShortName' => _('Freeradius'), 'plShortName' => _('Freeradius'),
'plDescription' => _('Radius accounting based on FreeRadius'), 'plDescription' => _('FreeRadius information'),
'plFilter' => '(objectClass=radiusprofile)', 'plFilter' => '(objectClass=radiusprofile)',
'plIcon' => 'geticon.php?context=applications&icon=freeradius&size=48', 'plIcon' => 'geticon.php?context=applications&icon=freeradius&size=48',
'plSmallIcon' => 'geticon.php?context=applications&icon=freeradius&size=16', 'plSmallIcon' => 'geticon.php?context=applications&icon=freeradius&size=16',
...@@ -73,9 +73,11 @@ class freeradiusAccount extends simplePlugin ...@@ -73,9 +73,11 @@ class freeradiusAccount extends simplePlugin
'name' => _('Groups'), 'name' => _('Groups'),
'attrs' => [ 'attrs' => [
new SetAttribute( new SetAttribute(
new SelectAttribute( new ObjectSelectAttribute(
_('Groups'), _('FreeRadius Groups'), _('Groups'), _('FreeRadius Groups'),
'radiusGroupName', FALSE 'radiusGroupName', FALSE,
['group'], 'cn', 'cn',
'(objectClass=radiusprofile)'
) )
), ),
], ],
...@@ -161,22 +163,4 @@ class freeradiusAccount extends simplePlugin ...@@ -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