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


PHP adLDAP::utilities方法代碼示例

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


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

示例1: createMailbox

 /**
  * Create an Exchange account
  * 
  * @param string $username The username of the user to add the Exchange account to
  * @param array $storageGroup The mailbox, Exchange Storage Group, for the user account, this must be a full CN
  *                            If the storage group has a different base_dn to the adLDAP configuration, set it using $base_dn
  * @param string $emailAddress The primary email address to add to this user
  * @param string $mailNickname The mail nick name.  If mail nickname is blank, the username will be used
  * @param bool $mdbUseDefaults Indicates whether the store should use the default quota, rather than the per-mailbox quota.
  * @param string $baseDn Specify an alternative base_dn for the Exchange storage group
  * @param bool $isGUID Is the username passed a GUID or a samAccountName
  * @return bool
  */
 public function createMailbox($username, $storageGroup, $emailAddress, $mailNickname = NULL, $useDefaults = TRUE, $baseDn = NULL, $isGUID = false)
 {
     if ($username === NULL) {
         return "Missing compulsory field [username]";
     }
     if ($storageGroup === NULL) {
         return "Missing compulsory array [storagegroup]";
     }
     if (!is_array($storageGroup)) {
         return "[storagegroup] must be an array";
     }
     if ($emailAddress === NULL) {
         return "Missing compulsory field [emailAddress]";
     }
     if ($baseDn === NULL) {
         $baseDn = $this->adldap->getBaseDn();
     }
     $container = "CN=" . implode(",CN=", $storageGroup);
     if ($mailNickname === NULL) {
         $mailNickname = $username;
     }
     $mdbUseDefaults = $this->adldap->utilities()->boolToString($useDefaults);
     $attributes = array('exchange_homemdb' => $container . "," . $baseDn, 'exchange_proxyaddress' => 'SMTP:' . $emailAddress, 'exchange_mailnickname' => $mailNickname, 'exchange_usedefaults' => $mdbUseDefaults);
     $result = $this->adldap->user()->modify($username, $attributes, $isGUID);
     if ($result == false) {
         return false;
     }
     return true;
 }
開發者ID:kidaa,項目名稱:time-slot,代碼行數:42,代碼來源:adLDAPExchange.php

示例2: getPrimaryGroup

 /**
  * Coping with AD not returning the primary group
  * http://support.microsoft.com/?kbid=321360 
  * 
  * This is a re-write based on code submitted by Bruce which prevents the 
  * need to search each security group to find the true primary group
  * 
  * @param string $gid Group ID
  * @param string $usersid User's Object SID
  * @return string
  */
 public function getPrimaryGroup($gid, $usersid)
 {
     if ($gid === NULL || $usersid === NULL) {
         return false;
     }
     $r = false;
     $gsid = substr_replace($usersid, pack('V', $gid), strlen($usersid) - 4, 4);
     $filter = '(objectsid=' . $this->adldap->utilities()->getTextSID($gsid) . ')';
     $fields = array("samaccountname", "distinguishedname");
     $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
     $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
     return $entries[0]['distinguishedname'][0];
 }
開發者ID:Trideon,項目名稱:gigolo,代碼行數:24,代碼來源:adLDAPGroups.php

示例3: usernameToGuid

 /**
  * Converts a username (samAccountName) to a GUID
  * 
  * @param string $username The username to query
  * @return string
  */
 public function usernameToGuid($username)
 {
     if (!$this->adldap->getLdapBind()) {
         return false;
     }
     if ($username === null) {
         return "Missing compulsory field [username]";
     }
     $filter = "samaccountname=" . $username;
     $fields = array("objectGUID");
     $sr = @ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
     if (ldap_count_entries($this->adldap->getLdapConnection(), $sr) > 0) {
         $entry = @ldap_first_entry($this->adldap->getLdapConnection(), $sr);
         $guid = @ldap_get_values_len($this->adldap->getLdapConnection(), $entry, 'objectGUID');
         $strGUID = $this->adldap->utilities()->binaryToText($guid[0]);
         return $strGUID;
     }
     return false;
 }
開發者ID:wernerflamme,項目名稱:dokuwiki,代碼行數:25,代碼來源:adLDAPUsers.php

示例4: groups

 /**
  * Determine the list of groups a contact is a member of
  * 
  * @param string $distinguisedname The full DN of a contact
  * @param bool $recursive Recursively check groups
  * @return array
  */
 public function groups($distinguishedName, $recursive = NULL)
 {
     if ($distinguishedName === NULL) {
         return false;
     }
     if ($recursive === NULL) {
         $recursive = $this->adldap->getRecursiveGroups();
     }
     //use the default option if they haven't set it
     if (!$this->adldap->getLdapBind()) {
         return false;
     }
     // Search the directory for their information
     $info = @$this->info($distinguishedName, array("memberof", "primarygroupid"));
     $groups = $this->adldap->utilities()->niceNames($info[0]["memberof"]);
     //presuming the entry returned is our contact
     if ($recursive === true) {
         foreach ($groups as $id => $groupName) {
             $extraGroups = $this->adldap->group()->recursiveGroups($groupName);
             $groups = array_merge($groups, $extraGroups);
         }
     }
     return $groups;
 }
開發者ID:kinhvan017,項目名稱:phpipam,代碼行數:31,代碼來源:adLDAPContacts.php


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