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

Do not use global variables #4

Closed coudot closed 7 months ago

coudot commented 1 year ago

We need to pass all parameters to functions and not rely on globals

davidcoutadeur commented 7 months ago

Implied modifications in the corresponding LTB projects:

    function __construct( $mail_priority,
                          $mail_charset,
                          $mail_contenttype,
                          $mail_wordwrap,
                          $mail_sendmailpath,
                          $mail_protocol,
                          $mail_smtp_debug,
                          $mail_debug_format,
                          $mail_smtp_host,
                          $mail_smtp_port,
                          $mail_smtp_secure,
                          $mail_smtp_autotls,
                          $mail_smtp_auth,
                          $mail_smtp_user,
                          $mail_smtp_pass,
                          $mail_smtp_keepalive,
                          $mail_smtp_options,
                          $mail_smtp_timeout
                        )
$mailer = new \Ltb\Mail(...);
$mailer->send_mail($mail, $mail_from, $mail_from_name, $subject, $body, $data) {
    public function __construct(
                          $ldap_url,
                          $ldap_starttls,
                          $ldap_binddn,
                          $ldap_bindpw,
                          $ldap_network_timeout,
                          $ldap_user_base,
                          $ldap_size_limit,
                          $ldap_krb5ccname
                      )
connect
search
get_list
ldapSort
sorted_search
get_password_value
change_ad_password_as_user
change_password_with_exop
modify_attributes_using_ppolicy
modify_attributes
get_list
sorted_search
get_password_value
change_ad_password_as_user
change_password_with_exop
modify_attributes_using_ppolicy
modify_attributes
// old signature:
    function search($ldap_filter,$attributes)
// new signature:
    function search($ldap_filter,$attributes, $attributes_map, $search_result_title, $search_result_sortby, $search_result_items)
    {
davidcoutadeur commented 7 months ago

Refactoring seems ready now.

I have tested and adapted self-service-password to the ltb-ldap changes

We'll have to: