Skip to content

Commit

Permalink
fixed issue on group removal and DN change
Browse files Browse the repository at this point in the history
  • Loading branch information
gruberroland committed Nov 28, 2023
1 parent 8344238 commit 3b242f5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lam/lib/modules/windowsUser.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2687,7 +2687,8 @@ class windowsUser extends baseModule implements passwordService,AccountStatusPro
// remove groups
for ($i = 0; $i < sizeof($toRem); $i++) {
if (in_array($toRem[$i], $groups)) {
$success = @ldap_mod_del($_SESSION['ldap']->server(), $toRem[$i], array('member' => array($this->getAccountContainer()->dn_orig)));
// membership is removed with potentially new DN as Windows updates group automatically on user move
$success = @ldap_mod_del($_SESSION['ldap']->server(), $toRem[$i], array('member' => array($this->getAccountContainer()->finalDN)));
if (!$success) {
logNewMessage(LOG_ERR, 'Unable to delete user ' . $this->getAccountContainer()->finalDN . ' from group: ' . $toRem[$i] . ' (' . ldap_error($_SESSION['ldap']->server()) . ').');
$messages[] = array('ERROR', sprintf(_('Was unable to remove attributes from DN: %s.'), $toRem[$i]), getDefaultLDAPErrorString($_SESSION['ldap']->server()));
Expand Down

0 comments on commit 3b242f5

Please sign in to comment.