Tools

Creation and modification of DN strings

Using the filter API to create search filters

Example #1 Create simple LDAP filters

  1. $f1  = Zend_Ldap_Filter::equals('name', 'value');         // (name=value)
  2. $f2  = Zend_Ldap_Filter::begins('name', 'value');         // (name=value*)
  3. $f3  = Zend_Ldap_Filter::ends('name', 'value');           // (name=*value)
  4. $f4  = Zend_Ldap_Filter::contains('name', 'value');       // (name=*value*)
  5. $f5  = Zend_Ldap_Filter::greater('name', 'value');        // (name>value)
  6. $f6  = Zend_Ldap_Filter::greaterOrEqual('name', 'value'); // (name>=value)
  7. $f7  = Zend_Ldap_Filter::less('name', 'value');           // (name<value)
  8. $f8  = Zend_Ldap_Filter::lessOrEqual('name', 'value');    // (name<=value)
  9. $f9  = Zend_Ldap_Filter::approx('name', 'value');         // (name~=value)
  10. $f10 = Zend_Ldap_Filter::any('name');                     // (name=*)

Example #2 Create more complex LDAP filters

  1. $f1 = Zend_Ldap_Filter::ends('name', 'value')->negate(); // (!(name=*value))
  2.  
  3. $f2 = Zend_Ldap_Filter::equals('name', 'value');
  4. $f3 = Zend_Ldap_Filter::begins('name', 'value');
  5. $f4 = Zend_Ldap_Filter::ends('name', 'value');
  6.  
  7. // (&(name=value)(name=value*)(name=*value))
  8. $f5 = Zend_Ldap_Filter::andFilter($f2, $f3, $f4);
  9.  
  10. // (|(name=value)(name=value*)(name=*value))
  11. $f6 = Zend_Ldap_Filter::orFilter($f2, $f3, $f4);

Modify LDAP entries using the Attribute API

blog comments powered by Disqus