public function getLdapQuery($conditions = null, $objectClass = null) {
		if (!empty($objectClass)) {
			$objectClass = mb_strtolower($objectClass);
		} else {
			$objectClass = 'user';
		}

		$baseQuery = '(!(useraccountcontrol:1.2.840.113556.1.4.803:=2))(objectClass=' . $objectClass . ')';
		if ($objectClass === 'user') {
			$baseQuery .= '(userAccountControl:1.2.840.113556.1.4.803:=512)';
		}

		if (empty($conditions) || !is_array($conditions)) {
			return $baseQuery;
		}

		$result = '(&' . $baseQuery;
		foreach ($conditions as $attribute => $value) {
			list(, $attributeName) = pluginSplit($attribute);
			if (empty($value)) {
				continue;
			}

			switch ($attributeName) {
				case CAKE_LDAP_LDAP_DISTINGUISHED_NAME:
					$attributeName = CAKE_LDAP_LDAP_ATTRIBUTE_DISTINGUISHED_NAME;
					break;
				case CAKE_LDAP_LDAP_ATTRIBUTE_OBJECT_GUID:
					$value = GuidStringToLdap($value);
					break;
			}
			$result .= '(' . $attributeName . '=' . (string)$value . ')';
		}
		$result .= ')';

		return $result;
	}