getSuffixList() no longer supports self service

This commit is contained in:
Roland Gruber 2016-12-31 10:55:56 +01:00
parent 7f6574af8c
commit b408538403
2 changed files with 10 additions and 10 deletions

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2005 - 2014 Roland Gruber
Copyright (C) 2005 - 2016 Roland Gruber
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
@ -144,14 +144,8 @@ class baseType {
* @return array sorted list of possible suffixes for this type.
*/
public function getSuffixList() {
if (isset($_SESSION["config"])) {
$suffix = $_SESSION["config"]->get_Suffix(get_class($this));
$connection = $_SESSION["ldap"]->server();
}
else {
$suffix = $_SESSION['selfServiceProfile']->LDAPSuffix;
$connection = $_SESSION['ldapHandle'];
}
$suffix = $_SESSION["config"]->get_Suffix(get_class($this));
$connection = $_SESSION["ldap"]->server();
$ret = array();
$filter = $this->getSuffixFilter();
$sr = @ldap_search($connection, escapeDN($suffix),$filter , array('dn', 'objectClass'), 0, 0, 0, LDAP_DEREF_NEVER);

View File

@ -2809,7 +2809,13 @@ class inetOrgPerson extends baseModule implements passwordService {
}
else {
$userObj = new user();
$ouList = $userObj->getSuffixList();
$filter = $userObj->getSuffixFilter();
$suffix = $_SESSION['selfServiceProfile']->LDAPSuffix;
$foundOus = searchLDAPPaged($_SESSION['ldapHandle'], $suffix, $filter, array('dn'), false, 0);
$ouList = array();
foreach ($foundOus as $foundOu) {
$ouList[] = $foundOu['dn'];
}
if (!empty($attributes['ou'][0]) && !in_array($attributes['ou'][0], $ouList)) {
$ouList[] = $attributes['ou'][0];
usort($ouList, 'compareDN');