简体   繁体   English

LDAP / PHP问题更新,新添加的用户

[英]LDAP/PHP Issue updating Newly Added User

The project I have been managing has ran into an issue of updating contents of LDAP. 我一直在管理的项目遇到了更新LDAP内容的问题。 My site uses ldap to make a list of users. 我的网站使用ldap列出用户。 New users are not showing any more, but old uses are. 新用户不再显示,但旧用法显示。 I have tracked the issue down to its roots but I am clueless upon whats going wrong. 我已将问题追根溯源,但是对于出什么问题我一无所知。 The main parts of the PHP goes like this: PHP的主要部分如下所示:

public function getMember($type){
     $memeber ="";
     if($type == "week1"){
          $group = $this->ldap->getGroupInfo(1006);
          $member = $group["users"];
     }else if ($type == "all"){
          $group = $this->ldap->getGroupInfo(1008);
          $member = $group["users"];
     } 

 var_dump($member[116]);       
 $i = 0;

 foreach($member as &$registered){
         $i++;
         $uid = $this->ldap->getUidFromUserName($registered);
         print_r($uid);
         $newInfo = array();
         print_r($registered);     
         if($uid != ""){
                  $userInfos = $this->ldap->getUserInfo($uid);
                  $newInfo["uID"] = $uid;
                  $newInfo["userName"] = $userInfos["userName"];
                  $newInfo["groups"] = $userInfos["groups"];
                  $userName = $newInfo["userName"]; 
         } else { false;
         }
} }
print_r($member);
$member = array_filter($member);
return $member;

var_dump(&members[116]); out put shows: string 'johnr' (length=5) johnr is the user I have added which is not showing up in the list. 输出显示: string 'johnr' (length=5) johnr是我添加的用户,该用户未显示在列表中。 This means my php above it is grabbing the user. 这意味着我上面的PHP正在吸引用户。 Usually number that do show up contain the uid, and all those $newinfo[...] = ... information. 通常显示的数字包含uid,以及所有这些$ newinfo [...] = ...信息。 This doesn't. 不是这样

johnr s group id is 1006 just for the information. 仅此信息, johnr的群组ID是1006。

The print_r($uid); print_r($uid); shows the uid, but of only those who show up on the list. 显示uid,但仅显示列表中的uid。 Meaning johnr's uid is not in that. 意思是johnr的uid不在其中。

Now if you look towards the bottom there print_r($member); 现在,如果您看向底部,则有print_r($member); that outputs [111] => [112] => [113] => [114] => [115] => [116] => [117] => [118] => [119] => [120] => [121] => [122] => [123] => [124] => ) which all these numbers are newly added users array number (johnr's is 116) what should print for each of these array numbers is something along the lines of [92] => Array ( [uID] => 2003 [userName] => testr [groups] => Array ( [0] => 1006 ) NOTE: This is what all the rest of the print shows for all the members showing up. above it is just a cut out of whats is print_r for those not showing up in the list. 输出[111] => [112] => [113] => [114] => [115] => [116] => [117] => [118] => [119] => [120] => [121] => [122] => [123] => [124] => ) ,其中所有这些数字都是新添加的用户数组编号(johnr为116),这些数组编号中的每一个应打印的内容[92] => Array ( [uID] => 2003 [userName] => testr [groups] => Array ( [0] => 1006 )注意:这是所有其余显示内容上面出现的成员,只是那些未出现在列表中的成员的print_r的一部分。

I did a ldapUserSearch and the johnr accounts ldif information is the same as working ones. 我做了ldapUserSearch, johnr帐户的ldif信息与工作信息相同。 I also did a ldapGroupSearch and johnr as well is the same as working users. 我也做了ldapGroupSearch和johnr ,与工作用户一样。

Another interesting thought is if you change the php code if statement to if($uid != "" || $uid == ""){ the php shows those users who are not showing up but null-ed. 另一个有趣的想法是,如果将php代码的if语句更改为if($uid != "" || $uid == ""){则php显示未显示但为null的用户。 So it has something to do with the $uid . 因此,它与$uid but johnr has a uid of 2099, so not sure exactly why its not finding one. 但是johnr的uid为2099,所以不确定到底为什么找不到它。

I hope this is enough information to get some help. 我希望这是足够的信息以获取帮助。 If you have any questions please comment that below and i'll do my best to answer them. 如果您有任何疑问,请在下面评论,我会尽力回答。

------Edit------/ - - - 编辑 - - - /

turns out its not grabbing the uID, Username, or group from ldap for johnr but is for every working name... its able to turn member to the array so johnr show up there but after that johnr has no properties it should have. 事实证明,它不是从ldap的johnr获取uID,用户名或组,而是针对每个工作名称...它能够将成员转为数组,因此johnr出现在该数组中,但是在此之后johnr应该没有属性。

All properties in the ldapUserSearch are the same for working and non-working users. ldapUserSearch中的所有属性对于工作用户和非工作用户都是相同的。 Also these non-working users are in the same groups as those working. 同样,这些非工作用户与工作用户位于同一组。

the getUidFromUserName function looks like this: getUidFromUserName函数如下所示:

public function getUidFromUserName($username) {
             if(isset($this->userNames[$username]))
                      return $this->userNames[$username];
             $this->lookupUsers();
             if(isset($this->userNames[$username]))
                      return $this->userNames[$username];
             else
                      return false;
}

More information. 更多信息。 All the working and non working accounts do show up in passwd and group with working standards. 所有工作帐户和非工作帐户的确会显示在passwd中,并与工作标准一起显示。

I am on a Linux server if thats information needed. 如果需要这些信息,我在Linux服务器上。

What in LDAP would cause an issue like this? LDAP中的什么会引起这样的问题?

Wasted too many hours on this... Just had to increase the search size in LDAP... I guess thats what happens when you are not allowed admin tools, you can't fight PHP trying to fix it when it doens't need to be fixed. 在此上浪费了太多时间...只是不得不增加LDAP中的搜索大小...我猜这就是当您不被允许使用管理工具时发生的事情,当不需要它时,您将无法与PHP尝试修复它等待修复。 :D :D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM