Skip to content

Commit

Permalink
make all search functions to use a scope (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Coutadeur authored and davidcoutadeur committed Jul 19, 2024
1 parent 0a56490 commit 70d0388
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions conf/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
$ldap_bindpw = "secret";
$ldap_base = "dc=example,dc=com";
$ldap_user_base = "ou=users,".$ldap_base;
$ldap_scope = "sub"; # possible values: sub, one, base
$ldap_user_filter = "(objectClass=inetOrgPerson)";
$ldap_ppolicy_filter = "(objectClass=pwdPolicy)";
$ldap_ppolicy_name_attribute = "cn";
Expand Down
8 changes: 8 additions & 0 deletions docs/ldap-parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ The filter can be set in ``$ldap_user_filter``:
$ldap_user_filter = "(objectClass=inetOrgPerson)";
You can set the scope for each search in ``$ldap_scope``:

.. code-block:: php
$ldap_scope = "sub";
.. tip:: sub is the default value. Possible values are sub, one, or base

Size limit
----------

Expand Down
2 changes: 1 addition & 1 deletion htdocs/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# Search attributes
$attributes = array();

[$ldap,$result,$nb_entries,$entries,$size_limit_reached]=$ldapInstance->search($ldap_filter, $attributes, $attributes_map, $search_result_title, $search_result_sortby, $search_result_items);
[$ldap,$result,$nb_entries,$entries,$size_limit_reached]=$ldapInstance->search($ldap_filter, $attributes, $attributes_map, $search_result_title, $search_result_sortby, $search_result_items, $ldap_scope);

if ( ! empty($entries) )
{
Expand Down
2 changes: 1 addition & 1 deletion htdocs/searchexpired.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Search attributes
$attributes = array('pwdChangedTime', 'pwdPolicySubentry');

[$ldap,$result,$nb_entries,$entries,$size_limit_reached]=$ldapInstance->search($ldap_filter, $attributes, $attributes_map, $search_result_title, $search_result_sortby, $search_result_items);
[$ldap,$result,$nb_entries,$entries,$size_limit_reached]=$ldapInstance->search($ldap_filter, $attributes, $attributes_map, $search_result_title, $search_result_sortby, $search_result_items, $ldap_scope);

if ( ! empty($entries) )
{
Expand Down
2 changes: 1 addition & 1 deletion htdocs/searchidle.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Search attributes
$attributes = array();

[$ldap,$result,$nb_entries,$entries,$size_limit_reached]=$ldapInstance->search($ldap_filter, $attributes, $attributes_map, $search_result_title, $search_result_sortby, $search_result_items);
[$ldap,$result,$nb_entries,$entries,$size_limit_reached]=$ldapInstance->search($ldap_filter, $attributes, $attributes_map, $search_result_title, $search_result_sortby, $search_result_items, $ldap_scope);

if ( ! empty($entries) )
{
Expand Down
2 changes: 1 addition & 1 deletion htdocs/searchlocked.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Search attributes
$attributes = array('pwdAccountLockedTime', 'pwdPolicySubentry');

[$ldap,$result,$nb_entries,$entries,$size_limit_reached]=$ldapInstance->search($ldap_filter, $attributes, $attributes_map, $search_result_title, $search_result_sortby, $search_result_items);
[$ldap,$result,$nb_entries,$entries,$size_limit_reached]=$ldapInstance->search($ldap_filter, $attributes, $attributes_map, $search_result_title, $search_result_sortby, $search_result_items, $ldap_scope);

if ( ! empty($entries) )
{
Expand Down
2 changes: 1 addition & 1 deletion htdocs/searchwillexpire.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Search attributes
$attributes = array('pwdChangedTime', 'pwdPolicySubentry');

[$ldap,$result,$nb_entries,$entries,$size_limit_reached]=$ldapInstance->search($ldap_filter, $attributes, $attributes_map, $search_result_title, $search_result_sortby, $search_result_items);
[$ldap,$result,$nb_entries,$entries,$size_limit_reached]=$ldapInstance->search($ldap_filter, $attributes, $attributes_map, $search_result_title, $search_result_sortby, $search_result_items, $ldap_scope);

if ( ! empty($entries) )
{
Expand Down

0 comments on commit 70d0388

Please sign in to comment.