/** * @param BatchModifyOperation $operation * @return BatchModifyOperation */ protected function hydrateModifyOperation(BatchModifyOperation $operation) { $batches = $this->convertValuesToLdap($operation->getBatchCollection(), $operation->getDn()); foreach ($batches as $batch) { /** @var \LdapTools\BatchModify\Batch $batch */ $batch->setAttribute($this->schema->getAttributeToLdap($batch->getAttribute())); } return $operation; }
/** * Workaround AD special cases with the unicodePwd attribute... * * @link https://support.microsoft.com/en-us/kb/263991 * @param BatchModifyOperation $operation */ protected function unicodePwdHack(BatchModifyOperation $operation) { if (!$this->isUnicodePwdHackNeeded()) { return; } foreach ($operation->getBatchCollection() as $batch) { if (strtolower($batch->getAttribute()) !== 'unicodepwd') { continue; } $values = $batch->getValues(); $batch->setValues(base64_encode(reset($values))); } }