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

🚜 feat(core) Remove groupSelect and GroupsAttribute

ObjectsAttribute should be used instead

issue #5965
parent 23b3c367
<?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.
*/
/*!
* \brief POSIX group selection
*/
class groupSelect extends simpleSelectManagement
{
protected $objectTypes = ['group'];
protected $autoFilter = FALSE;
function __construct ()
{
$this->filterXMLPath = get_template_path('group-filter.xml', TRUE, dirname(__FILE__));
parent::__construct();
}
}
<div class="contentboxh">
<p>{t}Filter{/t}</p>
</div>
<div class="contentboxb">
<label for="PRIMARY">{$PRIMARY}&nbsp;{t}Show primary groups{/t}</label><br/>
<label for="SAMBA">{$SAMBA}&nbsp;{t}Show samba groups{/t}</label><br/>
<label for="MAIL">{$MAIL}&nbsp;{t}Show mail groups{/t}</label><br/>
<hr/>
{$SCOPE}
<hr/>
<label for="NAME"><img src="geticon.php?context=actions&amp;icon=system-search&amp;size=16"/>{$NAME}</label>
<div>
{$APPLY}
</div>
</div>
<?xml version="1.0" encoding="UTF-8"?>
<filterdef>
<definition>
<category>group</category>
<template>../include/select/groupSelect/group-filter.tpl</template>
<initial>true</initial>
</definition>
<search>
<query>
<backend>LDAPBlacklist</backend>
<filter>(&amp;(objectClass=posixGroup)$NAME(|$PRIMARY$MAIL$SAMBA))</filter>
<attribute>dn</attribute>
<attribute>objectClass</attribute>
<attribute>cn</attribute>
<attribute>description</attribute>
</query>
<scope>auto</scope>
</search>
<element>
<type>checkbox</type>
<tag>PRIMARY</tag>
<default>true</default>
<unset></unset>
<set>(objectClass=posixGroup)</set>
</element>
<element>
<type>checkbox</type>
<tag>MAIL</tag>
<default>true</default>
<unset></unset>
<set>(objectClass=gosaMailAccount)</set>
</element>
<element>
<type>checkbox</type>
<tag>SAMBA</tag>
<default>true</default>
<unset></unset>
<set>(objectClass=sambaGroupMapping)</set>
</element>
<element>
<type>textfield</type>
<tag>NAME</tag>
<size>20</size>
<maxlength>60</maxlength>
<default></default>
<unset></unset>
<set>(|(cn=*$*)(description=*$*))</set>
<autocomplete>
<backend>LDAPBlacklist</backend>
<filter>(&amp;(objectClass=posixGroup)(|(cn=*$NAME*)(description=*$NAME*)))</filter>
<attribute>cn</attribute>
<attribute>description</attribute>
<frequency>0.5</frequency>
<characters>3</characters>
</autocomplete>
</element>
</filterdef>
......@@ -100,13 +100,6 @@ class SystemSelectDialog extends GenericSelectDialog
protected $dialogClass = 'systemSelect';
}
/*! \brief Group selection dialog
*/
class GroupSelectDialog extends GenericSelectDialog
{
protected $dialogClass = 'groupSelect';
}
/*! \brief Mail address selection dialog
*/
class MailSelectDialog extends GenericSelectDialog
......@@ -592,35 +585,6 @@ class UsersGroupsRolesAttribute extends ObjectsAttribute
}
}
/*! \brief This class allows to handle an attribute for selecting groups
*
* It looks like a SetAttribute, but clicking "Add" will open a dialog that allow to select one or more groups.
* It stores their dn as values, but displays the cn.
*
*/
class GroupsAttribute extends GenericDialogAttribute
{
protected $dialogClass = 'GroupSelectDialog';
function __construct ($label, $description, $ldapName, $required = FALSE, $defaultValue = [], $acl = '')
{
parent::__construct($label, $description, $ldapName, $required, $defaultValue, 'dn', 'cn', $acl);
}
function addValue ($dn, $entry)
{
if (!in_array($dn, $this->value)) {
$display = $entry['cn'][0];
if (isset($entry['description'][0]) && !empty($entry['description'][0])) {
$display .= ' ['.preg_replace('/^Group of user/', _('Group of user'), $entry['description'][0]).']';
}
$this->value[] = $dn;
$this->displays[] = $display;
}
}
}
/*! \brief This class allows to handle an attribute for selecting an mail address
*
* It looks like a SetAttribute, but clicking "Add" will open a dialog that allow to select one or more users.
......
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