GithubHelp home page GithubHelp logo

dreamscapes / ldap-core Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 1.0 713 KB

Object encapsulation of PHP's native ldap functions

Home Page: dreamscapes.github.io/Ldap-Core

License: BSD 3-Clause "New" or "Revised" License

PHP 91.61% Makefile 8.39%

ldap-core's People

Contributors

furgas avatar junowilderness avatar robertrossmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

furgas

ldap-core's Issues

Build is failing on Travis with PHP 5.x

PHP Warning:  PHP Startup: Unable to load dynamic library '/home/travis/.phpenv/versions/5.6.32/lib/php/extensions/no-debug-zts-20131226/ldap.so' - /home/travis/.phpenv/versions/5.6.32/lib/php/extensions/no-debug-zts-20131226/ldap.so: cannot open shared object file: No such file or directory in Unknown on line 0

Add support for parallel searches

This is a feature proposal. Comments and ideas are encouraged.

PHP allows doing parallel searches. This could greatly enhance application's performance in situations where multiple search requests need to be issued.

Currently, the only way to perform parallel search is to gather the underlying ldap link resources with Ldap::getResource() and calling ldap_search() directly. This, however, breaks the purpose of having a testable ldap interface. As such, support for this feature should be added into the library.

A proposed API could look like this:

  1. A new method is introduced, Ldap::parallelSearch() (or just Ldap::parallel()) with parameter signature identical to that of Ldap::ldapSearch()
  2. Each call to this method would store the parameters in an array for later use (i.e. in a protected Ldap::$parallels property)
  3. Once a call to Ldap::ldapSearch() is made (without arguments), a parallel search is executed with the params queued up in Ldap::$parallels and the results are returned in an array. The aforementioned protected property is emptied/reset.

Caveats

  • The above proposal would only work with doing parallel searches on the same ldap link, although PHP has no such limitation. This is not a big deal for Active Directory (you can always search the Global Catalog), but might be a problem for multi-domain setups for i.e. OpenLDAP users.

  • PHP does not allow retrieving specific sets of attributes for individual searches, i.e. you cannot tell PHP to retrieve only objectClass for first search and only objectCategory for the second search. I filed a PHP bug ages ago, but so far no progress has been made. In the past, I dealt with this by doing a union on the requested attributes, but this is somewhat unintuitive. A better approach would be to change the proposed API to not accept $attributes parameter in calls to Ldap::parallel() and only accept it once the Ldap::ldapSearch() method is called, i.e.:

    // Example. Actual method signatures may vary.
    $ldap->parallel('DC=example,DC=com', 'objectClass=user', Ldap::SCOPE_SUBTREE);
    $ldap->parallel('DC=example,DC=com', 'objectCategory=Person', Ldap::SCOPE_SUBTREE);
    $ldap->ldapSearch(['objectClass', 'objectCategory', 'cn']);

Suppress LDAP warnings and errors

With the native LdapExceptions being raised, it's redundant to have the native LDAP warnings and errors.

Maybe set and un-set an error handler before and after native function calls to make sure all errors and warnings are thrown as exceptions?

This could be an option set in the constructor of Dreamscapes\Ldap\Core\Ldap

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.