protected function _compareEmployeeInfo(array &$emploeeDbGuidCache, array &$extendInfo = [], $employeeInfoLdap = null, $useBlockEmployee = false, $useBlockDepartment = false) {
		if (empty($employeeInfoLdap)) {
			return false;
		}

		$extendInfoDefault = [
			'employeeInfoLocal' => [],
			'employeeDbDnCache' => [],
			'departmentCache' => [],
			'defaultValueFields' => [],
			'deleteBindData' => [],
		];
		$extendInfo = array_intersect_key($extendInfo, $extendInfoDefault);
		$extendInfo += $extendInfoDefault;

		$guid = $employeeInfoLdap[CAKE_LDAP_LDAP_ATTRIBUTE_OBJECT_GUID];
		if (isset($emploeeDbGuidCache[$guid])) {
			$extendInfo['employeeInfoLocal'] = $emploeeDbGuidCache[$guid];
			unset($emploeeDbGuidCache[$guid]);
		} else {
			$extendInfo['employeeInfoLocal'] = [];
		}

		$employeeInfoLdap = $this->_prepareEmployeeData($employeeInfoLdap, $extendInfo, $useBlockDepartment);
		if ($employeeInfoLdap === false) {
			return false;
		}

		$diffInfo = Hash::diff($employeeInfoLdap, $extendInfo['employeeInfoLocal']);
		if (empty($diffInfo)) {
			if (!$useBlockEmployee || ($useBlockEmployee && !$employeeInfoLdap['Employee']['block'])) {
				return true;
			}
		}
		if ($useBlockEmployee) {
			$employeeInfoLdap['Employee']['block'] = false;
		}

		if (isset($employeeInfoLdap['Department'])) {
			if (empty($employeeInfoLdap['Department']['value'])) {
				unset($employeeInfoLdap['Department']);
			} elseif ($useBlockDepartment) {
				$employeeInfoLdap['Department']['block'] = false;
			}
		}

		$resultData = $employeeInfoLdap;

		return $resultData;
	}
protected function _compareEmployeeInfo(array &$emploeeDbGuidCache, array &$extendInfo = [], $employeeInfoLdap = null, $useBlockEmployee = false, $useBlockDepartment = false) {
		if (empty($employeeInfoLdap)) {
			return false;
		}

		$extendInfoDefault = [
			'employeeInfoLocal' => [],
			'employeeDbDnCache' => [],
			'departmentCache' => [],
			'defaultValueFields' => [],
			'deleteBindData' => [],
		];
		$extendInfo = array_intersect_key($extendInfo, $extendInfoDefault);
		$extendInfo += $extendInfoDefault;

		$guid = $employeeInfoLdap[CAKE_LDAP_LDAP_ATTRIBUTE_OBJECT_GUID];
		if (isset($emploeeDbGuidCache[$guid])) {
			$extendInfo['employeeInfoLocal'] = $emploeeDbGuidCache[$guid];
			unset($emploeeDbGuidCache[$guid]);
		} else {
			$extendInfo['employeeInfoLocal'] = [];
		}

		$employeeInfoLdap = $this->_prepareEmployeeData($employeeInfoLdap, $extendInfo, $useBlockDepartment);
		if ($employeeInfoLdap === false) {
			return false;
		}

		$diffInfo = Hash::diff($employeeInfoLdap, $extendInfo['employeeInfoLocal']);
		if (empty($diffInfo)) {
			if (!$useBlockEmployee || ($useBlockEmployee && !$employeeInfoLdap['Employee']['block'])) {
				return true;
			}
		}
		if ($useBlockEmployee) {
			$employeeInfoLdap['Employee']['block'] = false;
		}

		if (isset($employeeInfoLdap['Department'])) {
			if (empty($employeeInfoLdap['Department']['value'])) {
				unset($employeeInfoLdap['Department']);
			} elseif ($useBlockDepartment) {
				$employeeInfoLdap['Department']['block'] = false;
			}
		}

		$resultData = $employeeInfoLdap;

		return $resultData;
	}
protected function _compareEmployeeInfo ( array & $ emploeeDbGuidCache , array & $ extendInfo = [ ] , $ employeeInfoLdap = null , $ useBlockEmployee = false , $ useBlockDepartment = false ) { if ( empty ( $ employeeInfoLdap ) ) { return false ; } $ extendInfoDefault = [ 'employeeInfoLocal' => [ ] , 'employeeDbDnCache' => [ ] , 'departmentCache' => [ ] , 'defaultValueFields' => [ ] , 'deleteBindData' => [ ] , ] ; $ extendInfo = array_intersect_key ( $ extendInfo , $ extendInfoDefault ) ; $ extendInfo += $ extendInfoDefault ; $ guid = $ employeeInfoLdap [ CAKE_LDAP_LDAP_ATTRIBUTE_OBJECT_GUID ] ; if ( isset ( $ emploeeDbGuidCache [ $ guid ] ) ) { $ extendInfo [ 'employeeInfoLocal' ] = $ emploeeDbGuidCache [ $ guid ] ; unset ( $ emploeeDbGuidCache [ $ guid ] ) ; } else { $ extendInfo [ 'employeeInfoLocal' ] = [ ] ; } $ employeeInfoLdap = $ this -> _prepareEmployeeData ( $ employeeInfoLdap , $ extendInfo , $ useBlockDepartment ) ; if ( $ employeeInfoLdap === false ) { return false ; } $ diffInfo = Hash :: diff ( $ employeeInfoLdap , $ extendInfo [ 'employeeInfoLocal' ] ) ; if ( empty ( $ diffInfo ) ) { if ( ! $ useBlockEmployee || ( $ useBlockEmployee && ! $ employeeInfoLdap [ 'Employee' ] [ 'block' ] ) ) { return true ; } } if ( $ useBlockEmployee ) { $ employeeInfoLdap [ 'Employee' ] [ 'block' ] = false ; } if ( isset ( $ employeeInfoLdap [ 'Department' ] ) ) { if ( empty ( $ employeeInfoLdap [ 'Department' ] [ 'value' ] ) ) { unset ( $ employeeInfoLdap [ 'Department' ] ) ; } elseif ( $ useBlockDepartment ) { $ employeeInfoLdap [ 'Department' ] [ 'block' ] = false ; } } $ resultData = $ employeeInfoLdap ; return $ resultData ; }
Compare information about employee from Active Directory and
from database.

@param array &$emploeeDbGuidCache Array information about employee
from database
@param array &$extendInfo Array of caches in format:
- key `employeeInfoLocal`, value - information of employee from
database;
- key `employeeDbDnCache`, value - information about employee
from database. Key: Employee Distinguished Name, value: Employee ID.
- key `departmentCache`, value - cache of departments from
database. Key: Delartment Name, value: Delartment ID.
- key `defaultValueFields`, value - cache of default value for
local fields of database. Key: employee field name, value: default value.
- key `deleteBindData`, value - list of IDs for deleting from binded models.
Key: name of binded model, value: list of IDs.
@param array $employeeInfoLdap Array information about employee
from LDAP.
@param bool $useBlockEmployee Use blocking employee instead delete on synchronize
@param bool $useBlockDepartment Use blocking department instead delete on synchronize
@return array|bool Return array of information about employee
from Active Directory if input data is not equal. Return False
on failure. Return True, input data is equal.
@see Sync::_prepareEmployeeData()
Compare information about employee from Active Directory and from database .