Merged in bugfix/PMCORE-773 (pull request #7773)

PMCORE-773 Ldap> OU for retired Employees> The state is not changed to inactive after executing cron.

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Roly Rudy Gutierrez Pinto
2021-01-27 19:15:39 +00:00
committed by Julio Cesar Laura Avendaño
2 changed files with 5 additions and 2 deletions

View File

@@ -1891,7 +1891,10 @@ class LdapAdvanced
do { do {
$aAttr = $this->ldapGetAttributes($ldapcnn, $oEntry); $aAttr = $this->ldapGetAttributes($ldapcnn, $oEntry);
$aUsers[] = $this->ldapGetUsersFromDepartment("GET", $aAttr["dn"]); $result = $this->ldapGetUsersFromDepartment("GET", $aAttr["dn"]);
foreach ($result as $item) {
$aUsers[] = $item;
}
} while ($oEntry = ldap_next_entry($ldapcnn, $oEntry)); } while ($oEntry = ldap_next_entry($ldapcnn, $oEntry));
} }
} }

View File

@@ -111,7 +111,6 @@ class ldapadvancedClassCron
//Get all users from Removed OU //Get all users from Removed OU
$this->usersRemovedOu = $plugin->getUsersFromRemovedOu($arrayAuthenticationSourceData); $this->usersRemovedOu = $plugin->getUsersFromRemovedOu($arrayAuthenticationSourceData);
$plugin->deactiveArrayOfUsers($this->usersRemovedOu);
//Variables //Variables
$this->deletedRemoved = count($this->usersRemovedOu); $this->deletedRemoved = count($this->usersRemovedOu);
@@ -427,6 +426,7 @@ class ldapadvancedClassCron
//Update Users data based on the LDAP Server //Update Users data based on the LDAP Server
$plugin->usersUpdateData($arrayAuthenticationSourceData["AUTH_SOURCE_UID"]); $plugin->usersUpdateData($arrayAuthenticationSourceData["AUTH_SOURCE_UID"]);
$plugin->deactiveArrayOfUsers($this->usersRemovedOu);
} catch (Exception $e) { } catch (Exception $e) {
$plugin = new LdapAdvanced(); $plugin = new LdapAdvanced();
$message = $e->getMessage(); $message = $e->getMessage();