• Hi, Thanks for your good plugin. I want to know that does it have this ability to create a new user in the LDAP Server via the WordPress registration form? I mean for non existence users in both LDAP Server and WordPress users. Thank you in advance

Viewing 1 replies (of 1 total)
  • Plugin Author Paul Ryan

    (@figureone)

    Not by default, mostly because most folks want to tightly control who gets added to their LDAP domain.

    That said, if you want to get creative you can hook into the authorizer_ldap_search_filter filter and connect to your LDAP server and do your ldap_add() calls there.

    Something like:

    /**
     * Add LDAP user when they try to connect.
     *
     * @param string $search_filter The filter to pass to ldap_search().
     * @param string $ldap_uid      The attribute to compare username against (from Authorizer Settings).
     * @param string $username      The username attempting to log in.
     */
    function add_ldap_user( $search_filter, $ldap_uid, $username ) {
    	$ldap = ldap_connect(...);
    	$search = ldap_search( $ldap, ...);
    	$ldap_users_found = ldap_get_entries( $ldap, $search );
    	if ( $ldap_users_found['count'] < 1 ) {
    		$result = ldap_add( $ldap, ...);
    	}
    	return $search_filter;
    }
    add_filter( 'authorizer_ldap_search_filter', 'add_ldap_user', 10, 3 );

    Here is where that filter is defined:
    https://github.com/uhm-coe/authorizer/blob/master/authorizer.php#L1510-L1520

Viewing 1 replies (of 1 total)
  • The topic ‘Create LDAP User/User Registrations’ is closed to new replies.