diff -C3 core-org/authentication_api.php core/authentication_api.php *** core-org/authentication_api.php 2010-02-04 19:12:14.000000000 +0000 --- core/authentication_api.php 2010-02-04 19:31:45.000000000 +0000 *************** *** 101,106 **** --- 101,123 ---- return false; } + } else if ( LDAP == $t_login_method ) { + if (ldap_authenticate( -1, $p_password, $p_username )) { + $t_email = ldap_email_from_username($p_username); + if (user_create( $p_username, $p_password, $t_email ) ) { + $t_user_id = user_get_id_by_name( $p_username ); + if ( false === $t_user_id ) { + # @@@ trigger an error here? + return false; + } + + } else { + # @@@ trigger an error here? + return false; + } + } else { + return false; + } } else { return false; } Wspólne podkatalogi: core-org/disposable i core/disposable diff -C3 core-org/ldap_api.php core/ldap_api.php *** core-org/ldap_api.php 2010-02-04 19:12:14.000000000 +0000 --- core/ldap_api.php 2010-02-04 19:13:14.000000000 +0000 *************** *** 119,125 **** # -------------------- # Attempt to authenticate the user against the LDAP directory # return true on successful authentication, false otherwise ! function ldap_authenticate( $p_user_id, $p_password ) { # if password is empty and ldap allows anonymous login, then # the user will be able to login, hence, we need to check # for this special case. --- 119,125 ---- # -------------------- # Attempt to authenticate the user against the LDAP directory # return true on successful authentication, false otherwise ! function ldap_authenticate( $p_user_id, $p_password, $p_username='' ) { # if password is empty and ldap allows anonymous login, then # the user will be able to login, hence, we need to check # for this special case. *************** *** 130,136 **** $t_ldap_organization = config_get( 'ldap_organization' ); $t_ldap_root_dn = config_get( 'ldap_root_dn' ); ! $t_username = user_get_field( $p_user_id, 'username' ); $t_ldap_uid_field = config_get( 'ldap_uid_field', 'uid' ) ; $t_search_filter = "(&$t_ldap_organization($t_ldap_uid_field=$t_username))"; $t_search_attrs = array( $t_ldap_uid_field, 'dn' ); --- 130,140 ---- $t_ldap_organization = config_get( 'ldap_organization' ); $t_ldap_root_dn = config_get( 'ldap_root_dn' ); ! if ($p_user_id == -1) { ! $t_username = $p_username; ! } else { ! $t_username = user_get_field( $p_user_id, 'username' ); ! } $t_ldap_uid_field = config_get( 'ldap_uid_field', 'uid' ) ; $t_search_filter = "(&$t_ldap_organization($t_ldap_uid_field=$t_username))"; $t_search_attrs = array( $t_ldap_uid_field, 'dn' );