Beispiel #1
0
@(include_once 'classes/Ldap.php');
@(include_once '../../install/config.ldap.php');
$ldap_account_email = $_POST['accEmail'];
$ldap_account_full_name = $_POST['accFullName'];
$ldap_account_base = $_POST['accBase'];
$ldap_user_pattern = $_POST['userPattern'];
$ldap_server = $_POST['ldapHost'];
$ldap_port = $_POST['ldapPort'];
$ldap_ssl_verify = $_POST['ldapSslVerify'] == 'true' ? true : false;
$ldap_start_tls = $_POST['ldapStartTls'] == 'true' ? true : false;
$ldap_bind_type = $_POST['bindType'];
$ldap_bind_scope = $_POST['bindScope'];
$ldap_password = isset($_POST['ldapPass']) && trim($_POST['ldapPass']) != '' ? $_POST['ldapPass'] : null;
$ldap_username = isset($_POST['ldapUser']) && trim($_POST['ldapUser']) != '' ? $_POST['ldapUser'] : null;
$auth = new Ldap();
$auth->setLdapAccountBase($ldap_account_base);
$auth->setLdapAccountEmail($ldap_account_email);
$auth->setLdapAccountFullname($ldap_account_full_name);
$auth->setLdapBindType($ldap_bind_type);
$auth->setLdapBindScope($ldap_bind_scope);
$auth->setLdapPassword($ldap_password);
$auth->setLdapUsername($ldap_username);
$auth->setLdapPort($ldap_port);
$auth->setLdapServer($ldap_server);
$auth->setLdapSslVerify($ldap_ssl_verify);
$auth->setLdapStartTls($ldap_start_tls);
$auth->setLdapUserPattern($ldap_user_pattern);
try {
    $username = $auth->getLdapUserAttribute();
    $info = $auth->listAllUsers(array($auth->getLdapUserAttribute(), $ldap_account_full_name, $ldap_account_email), 0);
    if (is_array($info)) {