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


PHP adLDAP::getRealPrimaryGroup方法代码示例

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


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

示例1: info

 /**
  * Get contact information. Returned in a raw array format from AD
  * 
  * @param string $distinguisedname The full DN of a contact
  * @param array $fields Attributes to be returned
  * @return array
  */
 public function info($distinguishedName, $fields = NULL)
 {
     if ($distinguishedName === NULL) {
         return false;
     }
     if (!$this->adldap->getLdapBind()) {
         return false;
     }
     $filter = "distinguishedName=" . $distinguishedName;
     if ($fields === NULL) {
         $fields = array("distinguishedname", "mail", "memberof", "department", "displayname", "telephonenumber", "primarygroupid", "objectsid");
     }
     $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
     $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
     if ($entries[0]['count'] >= 1) {
         // AD does not return the primary group in the ldap query, we may need to fudge it
         if ($this->adldap->getRealPrimaryGroup() && isset($entries[0]["primarygroupid"][0]) && isset($entries[0]["primarygroupid"][0])) {
             //$entries[0]["memberof"][]=$this->group_cn($entries[0]["primarygroupid"][0]);
             $entries[0]["memberof"][] = $this->adldap->group()->getPrimaryGroup($entries[0]["primarygroupid"][0], $entries[0]["objectsid"][0]);
         } else {
             $entries[0]["memberof"][] = "CN=Domain Users,CN=Users," . $this->adldap->getBaseDn();
         }
     }
     $entries[0]["memberof"]["count"]++;
     return $entries;
 }
开发者ID:kinhvan017,项目名称:phpipam,代码行数:33,代码来源:adLDAPContacts.php

示例2: info

 /**
  * Find information about the users. Returned in a raw array format from AD
  * 
  * @param string $username The username to query
  * @param array $fields Array of parameters to query
  * @param bool $isGUID Is the username passed a GUID or a samAccountName
  * @return array
  */
 public function info($username, $fields = NULL, $isGUID = false, $type = NULL)
 {
     if ($username === NULL) {
         return false;
     }
     if (!$this->adldap->getLdapBind()) {
         return false;
     }
     if ($isGUID === true) {
         $username = $this->adldap->utilities()->strGuidToHex($username);
         $filter = "objectguid=" . $username;
     } else {
         if (strstr($username, "@")) {
             $filter = "userPrincipalName=" . $username;
         } else {
             if ($type == "NetIQ") {
                 $filter = "cn=" . $username;
             } elseif ($type == "LDAP") {
                 $filter = "uid=" . $username;
             } else {
                 $filter = "samaccountname=" . $username;
             }
         }
     }
     $filter = ($type == "NetIQ" or $type == "LDAP") ? "(&(objectClass=person)({$filter}))" : "(&(objectCategory=person)({$filter}))";
     if ($fields === NULL) {
         $fields = array("samaccountname", "mail", "memberof", "department", "displayname", "telephonenumber", "primarygroupid", "objectsid");
     }
     if (!in_array("objectsid", $fields)) {
         $fields[] = "objectsid";
     }
     $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
     $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
     if ($type == "NetIQ" && sizeof(@$entries) > 0 && isset($entries)) {
         foreach ($entries as $key => $u) {
             @($entries[@$key]['displayname'] = $u['fullname']);
             @($entries[@$key]['samaccountname'] = $u['cn']);
         }
     }
     if (isset($entries[0])) {
         if ($entries[0]['count'] >= 1) {
             if (in_array("memberof", $fields)) {
                 // AD does not return the primary group in the ldap query, we may need to fudge it
                 if ($this->adldap->getRealPrimaryGroup() && isset($entries[0]["primarygroupid"][0]) && isset($entries[0]["objectsid"][0])) {
                     //$entries[0]["memberof"][]=$this->group_cn($entries[0]["primarygroupid"][0]);
                     $entries[0]["memberof"][] = $this->adldap->group()->getPrimaryGroup($entries[0]["primarygroupid"][0], $entries[0]["objectsid"][0]);
                 } else {
                     $entries[0]["memberof"][] = "CN=Domain Users,CN=Users," . $this->adldap->getBaseDn();
                 }
                 if (!isset($entries[0]["memberof"]["count"])) {
                     $entries[0]["memberof"]["count"] = 0;
                 }
                 $entries[0]["memberof"]["count"]++;
             }
         }
         return $entries;
     }
     return false;
 }
开发者ID:routenull0,项目名称:phpipam,代码行数:67,代码来源:adLDAPUsers.php

示例3: info

 /**
  * Find information about the users. Returned in a raw array format from AD
  * 
  * @param string $username The username to query
  * @param array $fields Array of parameters to query
  * @param bool $isGUID Is the username passed a GUID or a samAccountName
  * @return array
  */
 public function info($username, $fields = NULL, $isGUID = false)
 {
     if ($username === NULL) {
         return false;
     }
     if (!$this->adldap->getLdapBind()) {
         $GLOBALS["CLASS_ACTV"][] = __FUNCTION__ . ": LINE:" . __LINE__ . ":getLdapBind() return false";
         return false;
     }
     if ($isGUID === true) {
         $username = $this->adldap->utilities()->strGuidToHex($username);
         $filter = "objectguid=" . $username;
     } else {
         if (strstr($username, "@")) {
             $filter = "userPrincipalName=" . $username;
         } else {
             $filter = "samaccountname=" . $username;
         }
     }
     $filter = "(&(objectCategory=person)({$filter}))";
     if ($fields === NULL) {
         $fields = array("samaccountname", "mail", "memberof", "department", "displayname", "telephonenumber", "primarygroupid", "objectsid");
     }
     if (!in_array("objectsid", $fields)) {
         $fields[] = "objectsid";
     }
     $getBaseDn = $this->adldap->getBaseDn();
     $GLOBALS["CLASS_ACTV"][] = __FUNCTION__ . ": LINE:" . __LINE__ . ":Search {$filter} in {$getBaseDn}";
     $sr = ldap_search($this->adldap->getLdapConnection(), $getBaseDn, $filter, $fields);
     if (!$sr) {
         $GLOBALS["CLASS_ACTV"][] = __FUNCTION__ . ": LINE:" . __LINE__ . ":Search  Failed";
     }
     $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
     if (isset($entries[0])) {
         if ($entries[0]['count'] >= 1) {
             if (in_array("memberof", $fields)) {
                 // AD does not return the primary group in the ldap query, we may need to fudge it
                 if ($this->adldap->getRealPrimaryGroup() && isset($entries[0]["primarygroupid"][0]) && isset($entries[0]["objectsid"][0])) {
                     //$entries[0]["memberof"][]=$this->group_cn($entries[0]["primarygroupid"][0]);
                     $entries[0]["memberof"][] = $this->adldap->group()->getPrimaryGroup($entries[0]["primarygroupid"][0], $entries[0]["objectsid"][0]);
                 } else {
                     $entries[0]["memberof"][] = "CN=Domain Users,CN=Users," . $this->adldap->getBaseDn();
                 }
                 if (!isset($entries[0]["memberof"]["count"])) {
                     $entries[0]["memberof"]["count"] = 0;
                 }
                 $entries[0]["memberof"]["count"]++;
             }
         }
         return $entries;
     }
     return false;
 }
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:61,代码来源:adLDAPUsers.php

示例4: info

 /**
  * Find information about the users. Returned in a raw array format from AD
  * 
  * @param string $username The username to query
  * @param array $fields Array of parameters to query
  * @param bool $isGUID Is the username passed a GUID or a samAccountName
  * @return array
  */
 public function info($username, $fields = NULL, $isGUID = false)
 {
     if ($username === NULL) {
         return false;
     }
     //if (!$this->adldap->getLdapBind()) { print 'No bind!'; return false; }
     if ($isGUID === true) {
         $username = $this->adldap->utilities()->strGuidToHex($username);
         $filter = "objectguid=" . $username;
     } else {
         if (strstr($username, "@")) {
             $user = explode('@', $username);
             $user = $user[0];
             $filter = "uid=" . $user;
         } else {
             $filter = "uid=" . $username;
         }
     }
     $filter = "(&(objectClass=person)({$filter}))";
     if ($fields === NULL) {
         $fields = array("samaccountname", "mail", "memberof", "department", "displayname", "telephonenumber", "primarygroupid", "objectsid");
     }
     if (!in_array("objectsid", $fields)) {
         $fields[] = "objectsid";
     }
     $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
     $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
     if (isset($entries[0])) {
         if ($entries[0]['count'] >= 1) {
             if (in_array("memberof", $fields)) {
                 // AD does not return the primary group in the ldap query, we may need to fudge it
                 if ($this->adldap->getRealPrimaryGroup() && isset($entries[0]["primarygroupid"][0]) && isset($entries[0]["objectsid"][0])) {
                     //$entries[0]["memberof"][]=$this->group_cn($entries[0]["primarygroupid"][0]);
                     $entries[0]["memberof"][] = $this->adldap->group()->getPrimaryGroup($entries[0]["primarygroupid"][0], $entries[0]["objectsid"][0]);
                 } else {
                     $entries[0]["memberof"][] = "CN=Domain Users,CN=Users," . $this->adldap->getBaseDn();
                 }
                 if (!isset($entries[0]["memberof"]["count"])) {
                     $entries[0]["memberof"]["count"] = 0;
                 }
                 $entries[0]["memberof"]["count"]++;
             }
         }
         return $entries;
     }
     return false;
 }
开发者ID:nschexni,项目名称:theses.tulane.edu,代码行数:55,代码来源:adLDAPUsers.php


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