当前位置: 首页>>代码示例>>PHP>>正文


PHP Ldap::getRecords方法代码示例

本文整理汇总了PHP中Ldap::getRecords方法的典型用法代码示例。如果您正苦于以下问题:PHP Ldap::getRecords方法的具体用法?PHP Ldap::getRecords怎么用?PHP Ldap::getRecords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ldap的用法示例。


在下文中一共展示了Ldap::getRecords方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

                $countries[$obj->rowid] = array('rowid' => $obj->rowid, 'label' => $obj->label, 'code' => $obj->code);
            }
            $i++;
        }
    }
} else {
    dol_print_error($db);
    exit(-1);
}
$ldap = new Ldap();
$result = $ldap->connect_bind();
if ($result >= 0) {
    $justthese = array();
    // We disable synchro Dolibarr-LDAP
    $conf->global->LDAP_MEMBER_ACTIVE = 0;
    $ldaprecords = $ldap->getRecords('*', $conf->global->LDAP_MEMBER_DN, $conf->global->LDAP_KEY_MEMBERS, $required_fields, 0);
    if (is_array($ldaprecords)) {
        $db->begin();
        // Warning $ldapuser has a key in lowercase
        foreach ($ldaprecords as $key => $ldapuser) {
            $member = new Adherent($db);
            // Propriete membre
            $member->firstname = $ldapuser[$conf->global->LDAP_FIELD_FIRSTNAME];
            $member->lastname = $ldapuser[$conf->global->LDAP_FIELD_NAME];
            $member->login = $ldapuser[$conf->global->LDAP_FIELD_LOGIN];
            $member->pass = $ldapuser[$conf->global->LDAP_FIELD_PASSWORD];
            //$member->societe;
            $member->address = $ldapuser[$conf->global->LDAP_FIELD_ADDRESS];
            $member->zip = $ldapuser[$conf->global->LDAP_FIELD_ZIP];
            $member->town = $ldapuser[$conf->global->LDAP_FIELD_TOWN];
            $member->country = $ldapuser[$conf->global->LDAP_FIELD_COUNTRY];
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:31,代码来源:sync_members_ldap2dolibarr.php

示例2: Ldap

 print $langs->trans("CreateInternalUserDesc");
 print "<br>";
 print "<br>";
 if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') {
     /*
      * Affiche formulaire d'ajout d'un compte depuis LDAP
      * si on est en synchro LDAP vers Dolibarr
      */
     $ldap = new Ldap();
     $result = $ldap->connect_bind();
     if ($result >= 0) {
         $required_fields = array($conf->global->LDAP_KEY_USERS, $conf->global->LDAP_FIELD_FULLNAME, $conf->global->LDAP_FIELD_NAME, $conf->global->LDAP_FIELD_FIRSTNAME, $conf->global->LDAP_FIELD_LOGIN, $conf->global->LDAP_FIELD_LOGIN_SAMBA);
         // Remove from required_fields all entries not configured in LDAP (empty) and duplicated
         $required_fields = array_unique(array_values(array_filter($required_fields, "dolValidElement")));
         // Get from LDAP database an array of results
         $ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1);
         if (is_array($ldapusers)) {
             $liste = array();
             foreach ($ldapusers as $key => $ldapuser) {
                 // Define the label string for this user
                 $label = '';
                 foreach ($required_fields as $value) {
                     if ($value) {
                         $label .= $value . "=" . $ldapuser[$value] . " ";
                     }
                 }
                 $liste[$key] = $label;
             }
         } else {
             $message = '<div class="error">' . $ldap->error . '</div>';
         }
开发者ID:netors,项目名称:dolibarr,代码行数:31,代码来源:fiche.php

示例3: join

print "commitiferror=" . $forcecommit . "\n";
print "Mapped LDAP fields=" . join(',', $required_fields) . "\n";
print "\n";
print "Hit Enter to continue or CTRL+C to stop...\n";
$input = trim(fgets(STDIN));
if (empty($conf->global->LDAP_GROUP_DN)) {
    print $langs->trans("Error") . ': ' . $langs->trans("LDAP setup for groups not defined inside Dolibarr");
    exit(-1);
}
$ldap = new Ldap();
$result = $ldap->connect_bind();
if ($result >= 0) {
    $justthese = array();
    // We disable synchro Dolibarr-LDAP
    $conf->global->LDAP_SYNCHRO_ACTIVE = 0;
    $ldaprecords = $ldap->getRecords('*', $conf->global->LDAP_GROUP_DN, $conf->global->LDAP_KEY_GROUPS, $required_fields, 0, array($conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS));
    if (is_array($ldaprecords)) {
        $db->begin();
        // Warning $ldapuser has a key in lowercase
        foreach ($ldaprecords as $key => $ldapgroup) {
            $group = new UserGroup($db);
            $group->fetch('', $ldapgroup[$conf->global->LDAP_KEY_GROUPS]);
            $group->name = $ldapgroup[$conf->global->LDAP_GROUP_FIELD_FULLNAME];
            $group->nom = $group->name;
            // For backward compatibility
            $group->note = $ldapgroup[$conf->global->LDAP_GROUP_FIELD_DESCRIPTION];
            $group->entity = $conf->entity;
            //print_r($ldapgroup);
            if ($group->id > 0) {
                // Group update
                print $langs->transnoentities("GroupUpdate") . ' # ' . $key . ': name=' . $group->name;
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:31,代码来源:sync_groups_ldap2dolibarr.php


注:本文中的Ldap::getRecords方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。