/** * {@inheritdoc} */ public function toLdap($value) { /** * @todo There's a lot more potential logic that needs to happen for this to be accurate... */ if ($this->getOperationType() == AttributeConverterInterface::TYPE_SEARCH_TO && !$value) { $fb = new FilterBuilder(); $value = $fb->bNot($fb->eq('pwdLastSet', '0')); } else { $value = (bool) $value ? '0' : '-1'; } return $value; }
/** * Transform a bool value into the bitwise operator needed for the LDAP filter. * * @param bool $value * @return \LdapTools\Query\Operator\BaseOperator */ protected function getQueryOperator($value) { $fb = new FilterBuilder(); $mappedValue = $this->getArrayValue($this->getOptions()['uacMap'], $this->getAttribute()); $operator = $fb->bitwiseAnd('userAccountControl', $mappedValue); $value = $this->shouldInvertValue() ? !$value : $value; return $value ? $operator : $fb->bNot($operator); }
/** * Transform a bool value into the bitwise operator needed for the LDAP filter. * * @param bool $value * @return \LdapTools\Query\Operator\BaseOperator */ protected function getQueryOperator($value) { $fb = new FilterBuilder(); $bit = abs($this->getBitForAttribute($this->getAttribute())); $operator = $fb->bitwiseAnd('groupType', (string) $bit); $value = $this->shouldInvertValue() ? !$value : $value; return $value ? $operator : $fb->bNot($operator); }