fixed issue with group of names update

This commit is contained in:
Roland Gruber 2019-09-26 18:40:16 +02:00
parent cb699635c5
commit a1da6a897d
2 changed files with 5 additions and 2 deletions

View File

@ -2009,6 +2009,7 @@ class accountContainer {
if (!$success) {
logNewMessage(LOG_ERR, 'Unable to modify attributes of DN: ' . $DNs[$i] . ' (' . ldap_error($_SESSION['ldap']->server()) . '). '
. getExtendedLDAPErrorMessage($_SESSION['ldap']->server()));
logNewMessage(LOG_DEBUG, print_r($attributes[$DNs[$i]]['modify'], true));
$errors[] = array('ERROR', sprintf(_('Was unable to modify attributes of DN: %s.'), $DNs[$i]), getDefaultLDAPErrorString($_SESSION['ldap']->server()));
$stopprocessing = true;
}

View File

@ -815,7 +815,7 @@ class posixAccount extends baseModule implements passwordService {
$toAdd = array_values(array_diff($this->gonList, $this->gonList_orig));
$toRem = array_values(array_diff($this->gonList_orig, $this->gonList));
// update groups if DN changed
if (isset($accountContainer->dn_orig) && ($accountContainer->dn_orig != $accountContainer->finalDN)) {
if (isset($accountContainer->dn_orig) && (strtolower($accountContainer->dn_orig) != strtolower($accountContainer->finalDN))) {
// update owner/member/uniqueMember attributes
$searchAttrs = array('member', 'uniquemember', 'owner');
foreach ($searchAttrs as $searchAttr) {
@ -831,10 +831,12 @@ class posixAccount extends baseModule implements passwordService {
}
}
if ($found) {
$success = @ldap_mod_replace($_SESSION['ldap']->server(), $ownerGroups[$i]['dn'], array($searchAttr => $newOwners));
$attributesToModify = array($searchAttr => $newOwners);
$success = @ldap_mod_replace($_SESSION['ldap']->server(), $ownerGroups[$i]['dn'], $attributesToModify);
if (!$success) {
$ldapError = getDefaultLDAPErrorString($_SESSION['ldap']->server());
logNewMessage(LOG_ERR, 'Unable to modify attributes of DN: ' . $ownerGroups[$i]['dn'] . ' (' . $ldapError . ').');
logNewMessage(LOG_DEBUG, print_r($attributesToModify, true));
$messages[] = array('ERROR', sprintf(_('Was unable to modify attributes of DN: %s.'), $ownerGroups[$i]['dn']), $ldapError);
}
}