display abstract DNs
This commit is contained in:
parent
ce5f6e812f
commit
0c0c9968a3
|
@ -673,4 +673,25 @@ function cleanLDAPResult($entries) {
|
||||||
return $entries;
|
return $entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transforms a DN into a more user friendly format.
|
||||||
|
* E.g. "dc=company,dc=de" is transformed to "company > de".
|
||||||
|
*
|
||||||
|
* @param String $dn DN
|
||||||
|
* @return String transformed DN
|
||||||
|
*/
|
||||||
|
function getAbstractDN($dn) {
|
||||||
|
if ($dn == '') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
$parts = explode(',', $dn);
|
||||||
|
for ($i = 0; $i < sizeof($parts); $i++) {
|
||||||
|
$subparts = explode('=', $parts[$i]);
|
||||||
|
if (sizeof($subparts) == 2) {
|
||||||
|
$parts[$i] = $subparts[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return implode(' > ', $parts);
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -635,9 +635,9 @@ class lamList {
|
||||||
echo ("<select class=\"" . $this->type . "\" size=1 name=\"suffix\" onchange=\"listOUchanged('" . $this->type . "', this)\">\n");
|
echo ("<select class=\"" . $this->type . "\" size=1 name=\"suffix\" onchange=\"listOUchanged('" . $this->type . "', this)\">\n");
|
||||||
for ($i = 0; $i < sizeof($this->possibleSuffixes); $i++) {
|
for ($i = 0; $i < sizeof($this->possibleSuffixes); $i++) {
|
||||||
if ($this->suffix == $this->possibleSuffixes[$i]) {
|
if ($this->suffix == $this->possibleSuffixes[$i]) {
|
||||||
echo ("<option selected>" . $this->possibleSuffixes[$i] . "</option>\n");
|
echo ("<option value=\"" . $this->possibleSuffixes[$i] . "\" selected>" . getAbstractDN($this->possibleSuffixes[$i]) . "</option>\n");
|
||||||
}
|
}
|
||||||
else echo("<option>" . $this->possibleSuffixes[$i] . "</option>\n");
|
else echo("<option value=\"" . $this->possibleSuffixes[$i] . "\">" . getAbstractDN($this->possibleSuffixes[$i]) . "</option>\n");
|
||||||
}
|
}
|
||||||
echo ("</select>\n");
|
echo ("</select>\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1542,14 +1542,14 @@ class accountContainer {
|
||||||
// loop through all suffixes
|
// loop through all suffixes
|
||||||
$rootsuffix = $_SESSION['config']->get_Suffix($this->type);
|
$rootsuffix = $_SESSION['config']->get_Suffix($this->type);
|
||||||
foreach ($_SESSION['ldap']->search_units($rootsuffix) as $suffix) {
|
foreach ($_SESSION['ldap']->search_units($rootsuffix) as $suffix) {
|
||||||
echo "<option ";
|
echo '<option value="' . $suffix . '" ';
|
||||||
if ($this->dn == $suffix) {
|
if ($this->dn == $suffix) {
|
||||||
echo 'selected';
|
echo 'selected';
|
||||||
}
|
}
|
||||||
echo ">" . $suffix . "</option>\n";
|
echo ">" . getAbstractDN($suffix) . "</option>\n";
|
||||||
}
|
}
|
||||||
if (!($this->dn == '') && !in_array($this->dn, $_SESSION['ldap']->search_units($rootsuffix))) {
|
if (!($this->dn == '') && !in_array($this->dn, $_SESSION['ldap']->search_units($rootsuffix))) {
|
||||||
echo "<option selected>" . $this->dn . "</option>\n";;
|
echo '<option value="' . $this->dn . '" selected>' . getAbstractDN($this->dn) . "</option>\n";;
|
||||||
}
|
}
|
||||||
echo "</select>\n";
|
echo "</select>\n";
|
||||||
echo ' ';
|
echo ' ';
|
||||||
|
|
|
@ -244,12 +244,10 @@ class asteriskExtension extends baseModule {
|
||||||
array('kind' => 'text', 'text' => _("Extension owners") . '*'),
|
array('kind' => 'text', 'text' => _("Extension owners") . '*'),
|
||||||
array('kind' => 'input', 'name' => 'form_subpage_' . get_class($this) . '_user_open', 'type' => 'submit', 'value' => _('Change')),
|
array('kind' => 'input', 'name' => 'form_subpage_' . get_class($this) . '_user_open', 'type' => 'submit', 'value' => _('Change')),
|
||||||
array('kind' => 'help', 'value' => 'member'));
|
array('kind' => 'help', 'value' => 'member'));
|
||||||
for ($i = 0; $i < sizeof($this->attributes['member']); $i++) {
|
|
||||||
}
|
|
||||||
$memberPart = array();
|
$memberPart = array();
|
||||||
if (isset($this->attributes['member'])) {
|
if (isset($this->attributes['member'])) {
|
||||||
for ($i = 0; $i < sizeof($this->attributes['member']); $i++) {
|
for ($i = 0; $i < sizeof($this->attributes['member']); $i++) {
|
||||||
$memberPart[] = array(array('kind' => 'text', 'text' => $this->attributes['member'][$i]));
|
$memberPart[] = array(array('kind' => 'text', 'text' => getAbstractDN($this->attributes['member'][$i])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$return[] = array(
|
$return[] = array(
|
||||||
|
@ -280,10 +278,13 @@ class asteriskExtension extends baseModule {
|
||||||
for ($i = 0; $i < sizeof($entries); $i++) {
|
for ($i = 0; $i < sizeof($entries); $i++) {
|
||||||
$dn = $entries[$i]['dn'];
|
$dn = $entries[$i]['dn'];
|
||||||
if (isset($dn) && (!isset($this->attributes['member']) || !in_array($dn, $this->attributes['member']))) {
|
if (isset($dn) && (!isset($this->attributes['member']) || !in_array($dn, $this->attributes['member']))) {
|
||||||
$users_dn[] = $dn;
|
$users_dn[] = array($dn, getAbstractDN($dn));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$members = $this->attributes['member'];
|
$members = $this->attributes['member'];
|
||||||
|
for ($i = 0; $i < sizeof($members); $i++) {
|
||||||
|
$members[$i] = array($members[$i], getAbstractDN($members[$i]));
|
||||||
|
}
|
||||||
$return[] = array(array('kind' => 'table', 'value' => array(
|
$return[] = array(array('kind' => 'table', 'value' => array(
|
||||||
array(
|
array(
|
||||||
array('kind' => 'table', 'value' => array(
|
array('kind' => 'table', 'value' => array(
|
||||||
|
@ -306,7 +307,7 @@ class asteriskExtension extends baseModule {
|
||||||
array('kind' => 'fieldset', 'legend' => _("Extension owners"), 'value' => array(
|
array('kind' => 'fieldset', 'legend' => _("Extension owners"), 'value' => array(
|
||||||
array(
|
array(
|
||||||
array('kind' => 'fieldset', 'td' => array ('valign' => 'top'), 'legend' => _("Selected users"), 'value' => array (
|
array('kind' => 'fieldset', 'td' => array ('valign' => 'top'), 'legend' => _("Selected users"), 'value' => array (
|
||||||
array(array('kind' => 'select', 'name' => 'removeusers', 'size' => '15', 'multiple' => true, 'options' => $members)))
|
array(array('kind' => 'select', 'name' => 'removeusers', 'size' => '15', 'multiple' => true, 'options' => $members, 'descriptiveOptions' => true)))
|
||||||
),
|
),
|
||||||
array('kind' => 'table', 'value' => array(
|
array('kind' => 'table', 'value' => array(
|
||||||
array(array('kind' => 'input', 'type' => 'submit', 'name' => 'addusers_button', 'value' => '<=', 'td' => array('align' => 'center'))),
|
array(array('kind' => 'input', 'type' => 'submit', 'name' => 'addusers_button', 'value' => '<=', 'td' => array('align' => 'center'))),
|
||||||
|
@ -314,7 +315,7 @@ class asteriskExtension extends baseModule {
|
||||||
array(array('kind' => 'help', 'value' => 'member', 'td' => array('align' => 'center')))
|
array(array('kind' => 'help', 'value' => 'member', 'td' => array('align' => 'center')))
|
||||||
)),
|
)),
|
||||||
array('kind' => 'fieldset', 'td' => array('valign' => 'top'), 'legend' => _("Available users"), 'value' => array(
|
array('kind' => 'fieldset', 'td' => array('valign' => 'top'), 'legend' => _("Available users"), 'value' => array(
|
||||||
array(array('kind' => 'select', 'name' => 'addusers', 'size' => '15', 'multiple' => true, 'options' => $users_dn)))
|
array(array('kind' => 'select', 'name' => 'addusers', 'size' => '15', 'multiple' => true, 'options' => $users_dn, 'descriptiveOptions' => true)))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
|
|
|
@ -1061,6 +1061,9 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$dnUsers = array_keys($dnUsers);
|
$dnUsers = array_keys($dnUsers);
|
||||||
usort($dnUsers, array($_SESSION['ldap'], 'cmp_array'));
|
usort($dnUsers, array($_SESSION['ldap'], 'cmp_array'));
|
||||||
array_unshift($dnUsers, '-');
|
array_unshift($dnUsers, '-');
|
||||||
|
for ($i = 0; $i < sizeof($dnUsers); $i++) {
|
||||||
|
$dnUsers[$i] = array($dnUsers[$i], getAbstractDN($dnUsers[$i]));
|
||||||
|
}
|
||||||
$optionsSelected = array();
|
$optionsSelected = array();
|
||||||
if (isset($this->attributes['manager'][0])) {
|
if (isset($this->attributes['manager'][0])) {
|
||||||
$optionsSelected[] = $this->attributes['manager'][0];
|
$optionsSelected[] = $this->attributes['manager'][0];
|
||||||
|
@ -1070,7 +1073,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
$return[] = array(
|
$return[] = array(
|
||||||
array('kind' => 'text', 'text' => _('Manager')),
|
array('kind' => 'text', 'text' => _('Manager')),
|
||||||
array('kind' => 'select', 'name' => 'manager', 'size' => '1',
|
array('kind' => 'select', 'name' => 'manager', 'size' => '1', 'descriptiveOptions' => true,
|
||||||
'options' => $dnUsers, 'options_selected' => $optionsSelected),
|
'options' => $dnUsers, 'options_selected' => $optionsSelected),
|
||||||
array('kind' => 'help', 'value' => 'manager'));
|
array('kind' => 'help', 'value' => 'manager'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue