dreamscapes / ldap-core Goto Github PK
View Code? Open in Web Editor NEWObject encapsulation of PHP's native ldap functions
Home Page: dreamscapes.github.io/Ldap-Core
License: BSD 3-Clause "New" or "Revised" License
Object encapsulation of PHP's native ldap functions
Home Page: dreamscapes.github.io/Ldap-Core
License: BSD 3-Clause "New" or "Revised" License
How should I, using this library, approach searching with pagination as shown in "Example _#_2 LDAP pagination" on http://php.net/manual/en/function.ldap-control-paged-result.php ?
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
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:
Ldap::parallelSearch()
(or just Ldap::parallel()
) with parameter signature identical to that of Ldap::ldapSearch()
Ldap::$parallels
property)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.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']);
Add PHP 7.x test runs to Travis so we have at least a "smoke test".
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
PHP 8.1 introduced a breaking change: https://php.watch/versions/8.1/LDAP-resource
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.