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

:tractor: feat(netgroups) Migrate netgroups to selectManagement

issue #5937
Showing with 13 additions and 59 deletions
+13 -59
......@@ -3,7 +3,7 @@
This code is part of FusionDirectory (http://www.fusiondirectory.org)
Copyright (C) 2011 Alejandro Escanero Blanco (aescanero@gmail.com)
Copyright (C) 2011-2016 FusionDirectory
Copyright (C) 2011-2019 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
......@@ -20,26 +20,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
class CnNetgroupsAttribute extends DialogAttribute
{
protected $dialogClass = "NetgroupSelectDialog";
function addValue ($dn, $entry)
{
$value = $entry['cn'][0];
if (!in_array($value, $this->value)) {
$this->value[] = $value;
}
}
function getFilterBlackList ()
{
$cns = $this->getValue();
$cns[] = $this->plugin->cn;
return ['cn' => $cns];
}
}
class netgroup extends simplePlugin
{
static function plInfo (): array
......@@ -98,7 +78,12 @@ class netgroup extends simplePlugin
'name' => _('Netgroup members'),
'icon' => 'geticon.php?context=applications&icon=netgroups&size=16',
'attrs' => [
new CnNetgroupsAttribute('', _('NIS netgroup members'), 'memberNisNetgroup'),
new ObjectsAttribute(
'', _('NIS netgroup membership'),
'nisMembership', TRUE,
['netgroup'], [],
'cn', 'cn'
),
]
],
];
......
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org)
Copyright (C) 2013-2016 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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
class memberNisnetgroupSelect extends simpleSelectManagement
{
protected $objectTypes = ['netgroup'];
}
......@@ -3,7 +3,7 @@
This code is part of FusionDirectory (http://www.fusiondirectory.org)
Copyright (C) 2011 Alejandro Escanero Blanco (aescanero@gmail.com)
Copyright (C) 2011-2016 FusionDirectory
Copyright (C) 2011-2019 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
......@@ -20,16 +20,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
class NetgroupSelectDialog extends GenericSelectDialog
{
protected $dialogClass = 'memberNisnetgroupSelect';
}
class NetgroupsAttribute extends GroupsAttribute
{
protected $dialogClass = 'NetgroupSelectDialog';
}
class netgroupMembership extends simplePlugin
{
protected $displayHeader = TRUE;
......@@ -60,7 +50,11 @@ class netgroupMembership extends simplePlugin
'name' => _('Member of the following NIS Netgroups '),
'icon' => 'geticon.php?context=applications&icon=netgroups&size=16',
'attrs' => [
new NetgroupsAttribute('', _('NIS netgroup membership'), 'nisMembership', TRUE)
new ObjectsAttribute(
'', _('NIS netgroup membership'),
'nisMembership', TRUE,
['netgroup']
),
]
],
];
......
Supports Markdown
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