types specify suffix list
This commit is contained in:
parent
7a804a6198
commit
b66fd35204
|
@ -31,7 +31,7 @@ This script is used to display the account profile to the user. <br>
|
||||||
The profile options include the LDAP OU suffix and options provided by
|
The profile options include the LDAP OU suffix and options provided by
|
||||||
the account modules.<br>
|
the account modules.<br>
|
||||||
<br>
|
<br>
|
||||||
The values for the OU selection are read with <span style="font-weight: bold;">search_units()</span>.<br>
|
The values for the OU selection are read with <span style="font-weight: bold;">type->getSuffixList()</span>.<br>
|
||||||
<br>
|
<br>
|
||||||
The <span style="font-style: italic;">account modules</span> provide
|
The <span style="font-style: italic;">account modules</span> provide
|
||||||
all other profile options. The profile editor displays a separate
|
all other profile options. The profile editor displays a separate
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2005 - 2010 Roland Gruber
|
Copyright (C) 2005 - 2011 Roland Gruber
|
||||||
|
|
||||||
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
|
||||||
|
@ -129,6 +129,38 @@ class baseType {
|
||||||
public function getTitleBarSubtitle($attributes) {
|
public function getTitleBarSubtitle($attributes) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of LDAP suffixes for this type.
|
||||||
|
*
|
||||||
|
* @return array sorted list of possible suffixes for this type.
|
||||||
|
*/
|
||||||
|
public function getSuffixList() {
|
||||||
|
$suffix = $_SESSION["config"]->get_Suffix(get_class($this));
|
||||||
|
$ret = array();
|
||||||
|
$sr = @ldap_search($_SESSION["ldap"]->server(), escapeDN($suffix), "objectClass=organizationalunit", array("DN"), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
|
if ($sr) {
|
||||||
|
$units = ldap_get_entries($_SESSION["ldap"]->server(), $sr);
|
||||||
|
$units = cleanLDAPResult($units);
|
||||||
|
// extract Dns
|
||||||
|
for ($i = 0; $i < sizeof($units); $i++) {
|
||||||
|
if ($units[$i]['dn']) $ret[] = $units[$i]['dn'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// add root suffix if needed
|
||||||
|
$found = false;
|
||||||
|
for ($i = 0; $i < sizeof($ret); $i++) { // search suffix case-intensitive
|
||||||
|
if (strtolower($suffix) == strtolower($ret[$i])) {
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$found) {
|
||||||
|
$ret[] = $suffix;
|
||||||
|
}
|
||||||
|
usort($ret, 'compareDN');
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue