當前位置: 首頁>>代碼示例>>PHP>>正文


PHP adLDAP::user_info方法代碼示例

本文整理匯總了PHP中adLDAP::user_info方法的典型用法代碼示例。如果您正苦於以下問題:PHP adLDAP::user_info方法的具體用法?PHP adLDAP::user_info怎麽用?PHP adLDAP::user_info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在adLDAP的用法示例。


在下文中一共展示了adLDAP::user_info方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: executeSignin

 public function executeSignin($request)
 {
     $this->form = new sfGuardFormSignin();
     if ($request->isMethod('post')) {
         $data = $request->getParameter('signin');
         $adldap = new adLDAP(array('account_suffix' => '@sch.bme.hu', 'domain_controllers' => array('152.66.208.42'), 'ad_username' => $data['username'], 'ad_password' => $data['password']));
         try {
             $authUser = $adldap->authenticate($data['username'], $data['password']);
             if ($authUser === true) {
                 $userData = $adldap->user_info($data['username']);
                 $user = Doctrine::getTable('sfGuardUser')->findOneBy('username', $data['username']);
                 $save = false;
                 if ($user) {
                     if ($user->Profile->full_name != $userData[0]["displayname"][0] || $user->Profile->email != $userData[0]["mail"][0]) {
                         $save = true;
                     }
                 } else {
                     $user = new sfGuardUser();
                     $save = true;
                 }
                 if ($save) {
                     $user->username = $data['username'];
                     $user->password = $data['password'];
                     $user->Profile->full_name = $userData[0]["displayname"][0];
                     $user->Profile->email = $userData[0]["mail"][0];
                     $user->save();
                 }
             }
         } catch (Exception $e) {
             echo $e;
         }
     }
     parent::executeSignin($request);
 }
開發者ID:szelpe,項目名稱:cukorka,代碼行數:34,代碼來源:actions.class.php

示例2: TestPDC

function TestPDC()
{
    global $SAMSConf;
    $info = array();
    $lang = "./lang/lang.{$SAMSConf->LANG}";
    require $lang;
    if (isset($_GET["auth"])) {
        $auth = $_GET["auth"];
    }
    print "<H1>TEST PDC</H1>";
    $value = ExecuteShellScript("getwbinfousers", "{$SAMSConf->WBINFOPATH}");
    $a = explode(" ", $value);
    sort($a);
    $acount = count($a);
    if ($auth == "ntlm") {
        for ($i = 0; $i < $acount; $i++) {
            print "{$a[$i]}<BR>\n";
        }
    }
    if ($auth == "adld") {
        require_once "adldap.php";
        //create the LDAP connection
        $pdc = array("{$SAMSConf->LDAPSERVER}");
        $options = array(account_suffix => "@{$SAMSConf->LDAPDOMAIN}", base_dn => "{$SAMSConf->LDAPBASEDN}", domain_controllers => $pdc, ad_username => "{$SAMSConf->LDAPUSER}", ad_password => "{$SAMSConf->LDAPUSERPASSWD}", "", "", "");
        $ldap = new adLDAP($options);
        $groups = $ldap->all_groups($include_desc = false, $search = "*", $sorted = true);
        $gcount = count($groups);
        print "<TABLE CLASS=samstable>";
        print "<TH width=5%>No";
        print "<TH >{$SAMSConf->LDAPDOMAIN} groups";
        for ($i = 0; $i < $gcount; $i++) {
            echo "<TR><TD>{$i}:<TD>{$groups[$i]}<BR>";
        }
        echo "</TABLE><P>";
        $users = $ldap->all_users($include_desc = false, $search = "*", $sorted = true);
        $count = count($users);
        print "<TABLE CLASS=samstable>";
        print "<TH width=5%>No";
        print "<TH >{$SAMSConf->LDAPDOMAIN} users";
        for ($i = 0; $i < $count; $i++) {
            $userinfo = $ldap->user_info($users[$i], $fields = NULL);
            //$mcount=count($userinfo);
            echo "<TR><TD>{$i}:<TD> {$users[$i]} ";
            $aaa = $userinfo[0]["displayname"][0];
            //$aaa2 = $userinfo[0]["givenname"][0];
            //$aaa3 = $userinfo[0]["sn"][0];
            echo "<TD>{$aaa} ";
        }
        echo "</TABLE>";
    }
}
開發者ID:ruNovel,項目名稱:sams2,代碼行數:51,代碼來源:configbuttom_1_prop.php

示例3: array

    var_dump($result);
}
// create a user account
if (0) {
    $attributes = array("username" => "freds", "logon_name" => "freds@mydomain.local", "firstname" => "Fred", "surname" => "Smith", "company" => "My Company", "department" => "My Department", "email" => "freds@mydomain.local", "container" => array("Container Parent", "Container Child"), "enabled" => 1, "password" => "Password123");
    $result = $ldap->user_create($attributes);
    var_dump($result);
}
// retrieve the group membership for a user
if (0) {
    $result = $ldap->user_groups("username");
    print_r($result);
}
// retrieve information about a user
if (0) {
    $result = $ldap->user_info("username");
    print_r($result);
}
// check if a user is a member of a group
if (0) {
    $result = $ldap->user_ingroup("username", "Group Name");
    var_dump($result);
}
// modify a user account (this example will set "user must change password at next logon")
if (0) {
    $attributes = array("change_password" => 1);
    $result = $ldap->user_modify("username", $attributes);
    var_dump($result);
}
// change the password of a user
if (0) {
開發者ID:hcvcastro,項目名稱:pxp,代碼行數:31,代碼來源:examples.php

示例4: foreach

$adUsers = $adldap->all_users();
foreach ($adUsers as $adUser) {
    // loop over all the Active Directory users
    // skip the excluded usernames
    $skip = 0;
    foreach ($excludedUsers as $ex) {
        if ($ex == $adUser) {
            $skip = 1;
            break;
        }
    }
    if ($skip == 1) {
        continue;
    }
    // query LDAP for the full user info
    $userInfo = $adldap->user_info($adUser, $ldapAttributes);
    if (NewUser($adUser, $oemrUsers)) {
        // add new user
        echo "Adding user {$adUser}";
        if (AddUser($adUser, $userInfo)) {
            echo ", OK\n";
        } else {
            echo ", FAILED\n";
        }
    } else {
        // update existing users with Active Directory info
        echo "existing user {$adUser}";
        if (UpdateUser($adUser, $userInfo)) {
            echo ", OK\n";
        } else {
            echo ", FAILED\n";
開發者ID:katopenzz,項目名稱:openemr,代碼行數:31,代碼來源:adLDAP_sync.php

示例5: AddUsersFromAdLDAP

function AddUsersFromAdLDAP()
{
    require_once "adldap.php";
    global $SAMSConf;
    global $USERConf;
    $DB = new SAMSDB();
    $lang = "./lang/lang.{$SAMSConf->LANG}";
    require $lang;
    if ($USERConf->ToWebInterfaceAccess("UC") != 1) {
        exit(0);
    }
    if (isset($_GET["domainname"])) {
        $domainname = $_GET["domainname"];
    }
    if (isset($_GET["username"])) {
        $userlist = $_GET["username"];
    }
    if (isset($_GET["groupname"])) {
        $usergroup = $_GET["groupname"];
    }
    if (isset($_GET["usershablon"])) {
        $usershablon = $_GET["usershablon"];
    }
    if (isset($_GET["enabled"])) {
        $enabled = $_GET["enabled"];
    }
    if (isset($_GET["domain"])) {
        $domain = $_GET["domain"];
    }
    if (isset($_GET["newgroupname"])) {
        $newgroupname = $_GET["newgroupname"];
    }
    if ($enabled == "on") {
        $enabled = 1;
    } else {
        $enabled = -1;
    }
    if (strlen($domainname) > 1) {
        $domain = $domainname;
    }
    $i = 0;
    $adldserver = GetAuthParameter("adld", "adldserver");
    $basedn = GetAuthParameter("adld", "basedn");
    $adadmin = GetAuthParameter("adld", "adadmin");
    $adadminpasswd = GetAuthParameter("adld", "adadminpasswd");
    $adldusergroup = GetAuthParameter("adld", "usergroup");
    $LDAPBASEDN2 = strtok($basedn, ".");
    $LDAPBASEDN = "DC={$LDAPBASEDN2}";
    while (strlen($LDAPBASEDN2) > 0) {
        $LDAPBASEDN2 = strtok(".");
        if (strlen($LDAPBASEDN2) > 0) {
            $LDAPBASEDN = "{$LDAPBASEDN},DC={$LDAPBASEDN2}";
        }
    }
    $pdc = array("{$adldserver}");
    $options = array(account_suffix => "@{$basedn}", base_dn => "{$LDAPBASEDN}", domain_controllers => $pdc, ad_username => "{$adadmin}", ad_password => "{$adadminpasswd}", "", "", "");
    $ldap = new adLDAP($options);
    if ($usergroup == -1) {
        $QUERY = "SELECT s_group_id FROM sgroup where s_name = '{$newgroupname}'";
        $result = $DB->samsdb_query_value($QUERY);
        if ($result == 0) {
            $result = $DB->samsdb_query("INSERT INTO sgroup (s_name) VALUES('{$newgroupname}') ");
            $QUERY = "SELECT s_group_id FROM sgroup where s_name = '{$newgroupname}'";
            $result = $DB->samsdb_query_value($QUERY);
        }
        $row = $DB->samsdb_fetch_array();
        $usergroup = $row['s_group_id'];
    }
    $query = "select s_quote from shablon where s_shablon_id='{$usershablon}'";
    $num_rows = $DB->samsdb_query_value($query);
    $row = $DB->samsdb_fetch_array();
    $s_quote = $row['s_quote'];
    $DB->free_samsdb_query();
    while (strlen($userlist[$i]) > 0) {
        $string = $userlist[$i];
        $i++;
        $user = "{$string}";
        $username = UTF8ToSAMSLang($user);
        $num_rows = $DB->samsdb_query_value("SELECT * FROM squiduser WHERE s_nick='{$user}'");
        if ($num_rows == 0) {
            $userinfo = $ldap->user_info($user, $fields = NULL);
            $givenname = $userinfo[0]["givenname"][0];
            $sn = $userinfo[0]["sn"][0];
            $QUERY = "INSERT INTO squiduser (s_group_id, s_shablon_id, s_nick, s_domain, s_enabled, s_quote, s_family, s_name) VALUES('{$usergroup}', '{$usershablon}', '{$username}', '{$domain}', '{$enabled}', '{$s_quote}', '{$sn}', '{$givenname}')";
            $num_rows = $DB->samsdb_query($QUERY);
        }
    }
    print "<SCRIPT>\n";
    print " parent.lframe.location.href=\"lframe.php\"; \n";
    print " parent.tray.location.href = \"tray.php?show=exe&function=authadldtray&filename=authadldtray.php\"; \n";
    print "</SCRIPT> \n";
}
開發者ID:ruNovel,項目名稱:sams2,代碼行數:92,代碼來源:authadldbuttom_2_usersadd.php


注:本文中的adLDAP::user_info方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。