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