本文整理汇总了PHP中adLDAP::all_users方法的典型用法代码示例。如果您正苦于以下问题:PHP adLDAP::all_users方法的具体用法?PHP adLDAP::all_users怎么用?PHP adLDAP::all_users使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类adLDAP
的用法示例。
在下文中一共展示了adLDAP::all_users方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetDomainUsersList
function GetDomainUsersList()
{
global $SAMSConf;
global $USERConf;
if ($USERConf->ToWebInterfaceAccess("UC") != 1) {
exit;
}
$DB = new SAMSDB();
if ($SAMSConf->AUTH == "ntlm") {
$value = ExecuteShellScript("getwbinfousers", "{$SAMSConf->WBINFOPATH}/");
$a = explode(" ", $value);
sort($a);
$acount = count($a);
} else {
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);
$a = $ldap->all_users($include_desc = false, $search = "*", $sorted = true);
sort($a);
$acount = count($a);
}
print "<SELECT NAME=\"usernick\" ID=\"usernick\" SIZE=1 >\n";
for ($i = 0; $i < $acount; $i++) {
if ($SAMSConf->NTLMDOMAIN == "Y") {
if (strstr($a[$i], "+") != NULL) {
$domain = trim(strtok($a[$i], "+"));
$user = trim(strtok("+"));
$domainlen = strlen($domain);
$userlen = strlen($user);
} else {
$domain = trim(strtok($a[$i], "\\"));
$user = trim(strtok("\\"));
$domainlen = strlen($domain);
$userlen = strlen($user);
}
if (strlen($domain) == 0 || strlen($user) == 0) {
$user = $domain;
$domain = $SAMSConf->DEFAULTDOMAIN;
}
} else {
$domain = "{$SAMSConf->DEFAULTDOMAIN}";
$user = trim($a[$i]);
//$user=strtolower($user);
}
$result = $DB->samsdb_query("SELECT * FROM squidusers WHERE domain=\"{$domain}\"&&nick=\"{$user}\" ");
$row = $DB->samsdb_fetch_array($result);
if (strcmp($row['name'], $user) != 0 && strcmp($row['domain'], $domain) != 0) {
if ($SAMSConf->NTLMDOMAIN == "Y") {
print "<OPTION VALUE=\"{$domain}+{$user}\"> {$user}/{$domain} ";
} else {
print "<OPTION VALUE=\"{$user}\"> {$user} ";
}
}
}
print "</SELECT>\n";
}
示例2: ADLDtest
function ADLDtest()
{
global $SAMSConf;
global $USERConf;
if ($USERConf->ToWebInterfaceAccess("C") != 1) {
exit;
}
$info = array();
$lang = "./lang/lang.{$SAMSConf->LANG}";
require $lang;
print "<H1>Test AD connection</H1>";
require_once "src/adldap.php";
//create the LDAP connection
$adldserver = GetAuthParameter("adld", "adldserver");
$basedn = GetAuthParameter("adld", "basedn");
$adadmin = GetAuthParameter("adld", "adadmin");
$adadminpasswd = GetAuthParameter("adld", "adadminpasswd");
$usergroup = 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);
$charset = explode(",", $_SERVER['HTTP_ACCEPT_CHARSET']);
$groups = $ldap->all_groups($include_desc = false, $search = "*", $sorted = true);
$gcount = count($groups);
print "<TABLE CLASS=samstable>";
print "<TH width=5%>No";
print "<TH >{$adldtest_1_authldaptray} {$basedn}";
for ($i = 0, $j = 1; $i < $gcount; $i++, $j++) {
$groupname = UTF8ToSAMSLang($groups[$i]);
echo "<TR><TD>{$j}:<TD>{$groupname} <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 >{$adldtest_2_authldaptray} {$basedn}";
print "<TH > ";
$i = 0;
foreach ($users as $user) {
$i++;
$samaccountname = UTF8ToSAMSLang($user["samaccountname"]);
$displayname = UTF8ToSAMSLang($user["displayname"]);
echo "<TR><TD>{$i}: <TD> {$samaccountname} <TD> {$displayname}";
}
echo "</TABLE>";
}
示例3: 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>";
}
}
示例4: ImportFromAD
function ImportFromAD()
{
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);
}
echo "<H3>ImportFromAD</H3>";
if (isset($_GET["addtemplates"])) {
$addtemplates = $_GET["addtemplates"];
}
if (isset($_GET["addgroups"])) {
$addgroups = $_GET["addgroups"];
}
if (isset($_GET["addgroupname"])) {
$addgroupname = $_GET["addgroupname"];
}
if (isset($_GET["groupname"])) {
$idsamsgroup = $_GET["groupname"];
}
if (isset($_GET["newgroupname"])) {
$newgroupname = $_GET["newgroupname"];
}
if (isset($_GET["defaulttraf"])) {
$defaulttraf = $_GET["defaulttraf"];
}
if (isset($_GET["period"])) {
$period = $_GET["period"];
}
if (isset($_GET["newperiod"])) {
$newperiod = $_GET["newperiod"];
}
if (isset($_GET["clryear"])) {
$clryear = $_GET["clryear"];
}
if (isset($_GET["clrmonth"])) {
$clrmonth = $_GET["clrmonth"];
}
if (isset($_GET["clrday"])) {
$clrday = $_GET["clrday"];
}
if (isset($_GET["trange"])) {
$trange = $_GET["trange"];
}
if (isset($_GET["enabled"])) {
$enabled = $_GET["enabled"];
}
$addgroups = "on";
$addtemplates = "on";
if ($enabled == "on") {
$enabled = 1;
} else {
$enabled = 0;
}
if ($period == "A") {
$period = $newperiod;
$clrdate = "{$clryear}-{$clrmonth}-{$clrday}";
}
$adldserver = GetAuthParameter("adld", "adldserver");
$basedn = GetAuthParameter("adld", "basedn");
$adadmin = GetAuthParameter("adld", "adadmin");
$adadminpasswd = GetAuthParameter("adld", "adadminpasswd");
$usergroup = 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);
/* Если выбрана одна из групп SAMS */
if ($idsamsgroup >= 0) {
$i = 0;
while (strlen($addgroupname[$i]) > 0) {
$result = $DB->samsdb_query_value("SELECT s_name FROM shablon where s_name = '{$addgroupname[$i]}'");
if ($result == 0) {
if ($clrdate == "") {
$clrdate = "1980-01-01";
}
$DB->samsdb_query("INSERT INTO shablon ( s_name, s_quote, s_auth, s_period, s_clrdate, s_alldenied, \ts_shablon_id2 ) VALUES ( '{$addgroupname[$i]}', '{$defaulttraf}', 'adld', '{$period}', '{$clrdate}', '0', '-1' ) ");
$DB->samsdb_query_value("SELECT s_shablon_id FROM shablon WHERE s_name='{$addgroupname[$i]}' ");
$row = $DB->samsdb_fetch_array();
$sid = $row['s_shablon_id'];
$DB->free_samsdb_query();
$DB->samsdb_query("INSERT INTO sconfig_time ( s_shablon_id, s_trange_id ) VALUES ( '{$sid}', '{$trange}' ) ");
echo "create template {$addgroupname[$i]} <BR>";
$result = $DB->samsdb_query("INSERT INTO auth_param (s_auth, s_param, s_value) VALUES('adld', 'adldgroup', '{$addgroupname[$i]}') ");
}
$result = $DB->samsdb_query_value("SELECT s_name, s_shablon_id FROM shablon where s_name = '{$addgroupname[$i]}'");
$row = $DB->samsdb_fetch_array();
$shablonid = $row['s_shablon_id'];
$a = $ldap->all_users($include_desc = false, $search = "*", $sorted = true);
//.........这里部分代码省略.........
示例5: array
*===================================================*/
// the attributes we pull from Active Directory
$ldapAttributes = array("givenname", "sn", "displayname", "physicaldeliveryofficename", "homephone", "telephonenumber", "mobile", "pager", "facsimiletelephonenumber", "mail", "title", "department", "streetaddress", "postofficebox", "l", "st", "postalcode");
// mapping of Active Directory attributes to OpenEMR Users table columns
$attributeMapping = array("givenname" => "fname", "sn" => "lname", "telephonenumber" => "phonew1", "mobile" => "phonecell", "facsimiletelephonenumber" => "fax", "mail" => "email", "title" => "specialty", "streetaddress" => "street", "postofficebox" => "streetb", "l" => "city", "st" => "state", "postalcode" => "zip");
// create new instance and connect to AD with user & pass
// defined in adLDAP_conf.inc
$adldap = new adLDAP($adldap_options);
// gather all our known usernames from OpenEMR
// they will be used to compare what is found in Active Directory
$oemrUsers = array();
$sqlH = sqlStatement("select id, username from users");
while ($onerow = sqlFetchArray($sqlH)) {
array_push($oemrUsers, $onerow);
}
$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);
示例6: AddUsersFromADLDForm
function AddUsersFromADLDForm()
{
global $SAMSConf;
global $USERConf;
$lang = "./lang/lang.{$SAMSConf->LANG}";
require $lang;
if (isset($_GET["ldapgroup"])) {
$ldapgroup = $_GET["ldapgroup"];
}
if (isset($_GET["getgroup"])) {
$getgroup = $_GET["getgroup"];
}
if ($USERConf->ToWebInterfaceAccess("UC") != 1) {
exit(0);
}
PageTop("user.jpg", " {$usersbuttom_1_domain_AddUsersFromDomainForm_1} Active Directory ");
require_once "src/adldap.php";
print "<FORM NAME=\"AddDomainUsers\" ACTION=\"main.php\">\n";
$DB = new SAMSDB();
$adldserver = GetAuthParameter("adld", "adldserver");
$basedn = GetAuthParameter("adld", "basedn");
$adadmin = GetAuthParameter("adld", "adadmin");
$adadminpasswd = GetAuthParameter("adld", "adadminpasswd");
$usergroup = 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);
$usersgroupname = "Users";
$a = $ldap->all_users($include_desc = false, $search = "*", $sorted = true);
$acount = count($a);
if (strlen($ldapgroup) > 0 && $ldapgroup != "_allgroups_" && $ldapgroup != "_gettxtinput_") {
$usersgroupname = $ldapgroup;
} else {
if (strlen($ldapgroup) > 0 && $ldapgroup == "_gettxtinput_") {
$usersgroupname = $getgroup;
}
}
$groupinfo = $ldap->all_groups($include_desc = false, $search = "*", $sorted = true);
$gcount = count($groupinfo);
print "<FORM NAME=\"AddDomainUsers\" ACTION=\"main.php\">\n";
/* */
print "<SCRIPT language=JAVASCRIPT>\n";
print "function SelectADGroup(formname)\n";
print "{\n";
print " var group=formname.addgroupname.value; \n";
print " var getgroup=formname.getgroup.value; \n";
print " var str=\"main.php?show=exe&ldapgroup=\"+group+\"&getgroup=\"+getgroup+\"&function=addusersfromadldform&filename=authadldbuttom_2_usersadd.php\"; \n";
print " parent.basefrm.location.href=str;\n";
print "}\n";
print "function EnableTxtInput(formname)\n";
print "{\n";
print " value=document.forms[\"AddDomainUsers\"].elements[\"addgroupname\"].value;\n";
print " if(value==\"_gettxtinput_\") \n";
print " {\n";
print " document.forms[\"AddDomainUsers\"].elements[\"getgroup\"].disabled=false\n";
print " }\n";
print " else \n";
print " {\n";
print " document.forms[\"AddDomainUsers\"].elements[\"getgroup\"].disabled=true\n";
print " }\n";
print "}\n";
print "</SCRIPT> \n";
print "<TABLE WIDTH=90%>\n";
print "<TR><TD WIDTH=40%>{$usersbuttom_1_adldap_AddUsersFromAdLDAPForm_1}</TD>\n";
print "<TD WIDTH=60%><SELECT NAME=\"addgroupname\" onChange=EnableTxtInput(AddDomainUsers)>\n";
print "<OPTION VALUE=\"_allgroups_\" SELECT onselect=EnableTxtInput(AddDomainUsers)> {$usersbuttom_1_adldap_AddUsersFromAdLDAPForm_5}";
print "<OPTION VALUE=\"_gettxtinput_\" onselect=EnableTxtInput(AddDomainUsers)> {$usersbuttom_1_adldap_AddUsersFromAdLDAPForm_6}";
foreach ($groupinfo as $group) {
$groupname = UTF8ToSAMSLang($group);
print "<OPTION VALUE=\"{$groupname}\" onselect=EnableTxtInput(AddDomainUsers)> {$groupname}";
}
/*
for($i=0;$i<$gcount;$i++)
{
$groupname = UTF8ToSAMSLang($groupinfo[$i]);
print("<OPTION VALUE=\"$groupname\" onselect=EnableTxtInput(AddDomainUsers)> $groupname");
}
*/
print "</SELECT>\n";
print "<TR><TD WIDTH=40%>{$usersbuttom_1_adldap_AddUsersFromAdLDAPForm_7}\n";
print "<TD WIDTH=60%><INPUT TYPE=\"TEST\" NAME=\"getgroup\" SIZE=\"20\" DISABLED>\n";
print "</TABLE>\n";
print "<INPUT TYPE=\"BUTTON\" value=\"{$usersbuttom_1_adldap_AddUsersFromAdLDAPForm_2}\" onclick=SelectADGroup(AddDomainUsers)>\n";
print "<P>\n";
/* */
if (strlen($ldapgroup) > 0 && $ldapgroup != "_allgroups_" && $ldapgroup != "_gettxtinput_") {
printf("<B>{$usersbuttom_1_adldap_AddUsersFromAdLDAPForm_4}: <FONT COLOR=BLUE>{$ldapgroup}</FONT></B><BR>");
} else {
if (strlen($ldapgroup) > 0 && $ldapgroup == "_gettxtinput_") {
printf("<B>{$usersbuttom_1_adldap_AddUsersFromAdLDAPForm_4}: <FONT COLOR=BLUE>{$getgroup}</FONT></B><BR>");
} else {
print "<BR><B>{$usersbuttom_1_domain_AddUsersFromDomainForm_2}</B><BR>";
//.........这里部分代码省略.........