ltb-project / ltb-common

PHP framework for LTB project applications
https://packagist.org/packages/ltb-project/ldap
GNU General Public License v3.0
3 stars 2 forks source link

add a search function with scope #17

Closed davidcoutadeur closed 4 months ago

davidcoutadeur commented 4 months ago

A new function search_with_scope() could be defined as a proxy to ldap_search, ldap_list or ldap_read, depending on a new argument passed: the scope.

The signature would be:

 search_with_scope(
    array|string $base,
    array|string $filter,
    string $scope = "subtree",
    array $attributes = [],
    int $attributes_only = 0,
    int $sizelimit = -1,
    int $timelimit = -1,
    int $deref = LDAP_DEREF_NEVER,
    ?array $controls = null
): LDAP\Result|array|false

same signature as for ldap_search, but without LDAP\Connection|array $ldap,, and with $scope.

davidcoutadeur commented 4 months ago

It is more convenient to have a function signature with variable arguments.

Function signature being:

function search_with_scope(string $scope = "sub", ...$searchargs): LDAP\Result|array|false