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


PHP adLDAP::getBaseDn方法代码示例

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


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

 /**
  * Move a user account to a different OU
  *
  * @param string $username The username to move (please be careful here!)
  * @param array $container The container or containers to move the user to (please be careful here!).
  * accepts containers in 1. parent 2. child order
  * @return array
  */
 public function move($username, $container)
 {
     if (!$this->adldap->getLdapBind()) {
         return false;
     }
     if ($username === null) {
         return "Missing compulsory field [username]";
     }
     if ($container === null) {
         return "Missing compulsory field [container]";
     }
     if (!is_array($container)) {
         return "Container must be an array";
     }
     $userInfo = $this->info($username, array("*"));
     $dn = $userInfo[0]['distinguishedname'][0];
     $newRDn = "cn=" . $username;
     $container = array_reverse($container);
     $newContainer = "ou=" . implode(",ou=", $container);
     $newBaseDn = strtolower($newContainer) . "," . $this->adldap->getBaseDn();
     $result = @ldap_rename($this->adldap->getLdapConnection(), $dn, $newRDn, $newBaseDn, true);
     if ($result !== true) {
         return false;
     }
     return true;
 }
开发者ID:wernerflamme,项目名称:dokuwiki,代码行数:34,代码来源:adLDAPUsers.php

示例3: all

 /**
  * Return a list of all contacts
  * 
  * @param bool $includeDescription Include a description of a contact
  * @param string $search The search parameters
  * @param bool $sorted Whether to sort the results
  * @return array
  */
 public function all($includeDescription = false, $search = "*", $sorted = true)
 {
     if (!$this->adldap->getLdapBind()) {
         return false;
     }
     // Perform the search and grab all their details
     $filter = "(&(objectClass=contact)(cn=" . $search . "))";
     $fields = array("displayname", "distinguishedname");
     $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
     $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
     $usersArray = array();
     for ($i = 0; $i < $entries["count"]; $i++) {
         if ($includeDescription && strlen($entries[$i]["displayname"][0]) > 0) {
             $usersArray[$entries[$i]["distinguishedname"][0]] = $entries[$i]["displayname"][0];
         } elseif ($include_desc) {
             $usersArray[$entries[$i]["distinguishedname"][0]] = $entries[$i]["distinguishedname"][0];
         } else {
             array_push($usersArray, $entries[$i]["distinguishedname"][0]);
         }
     }
     if ($sorted) {
         asort($usersArray);
     }
     return $usersArray;
 }
开发者ID:kinhvan017,项目名称:phpipam,代码行数:33,代码来源:adLDAPContacts.php

示例4: info

 /**
  * Get information about a specific computer. Returned in a raw array format from AD
  * 
  * @param string $computerName The name of the computer
  * @param array $fields Attributes to return
  * @return array
  */
 public function info($computerName, $fields = NULL)
 {
     if ($computerName === NULL) {
         return false;
     }
     if (!$this->adldap->getLdapBind()) {
         return false;
     }
     $filter = "(&(objectClass=computer)(cn=" . $computerName . "))";
     if ($fields === NULL) {
         $fields = array("memberof", "cn", "displayname", "dnshostname", "distinguishedname", "objectcategory", "operatingsystem", "operatingsystemservicepack", "operatingsystemversion");
     }
     $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
     $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
     return $entries;
 }
开发者ID:kidaa,项目名称:time-slot,代码行数:23,代码来源:adLDAPComputers.php

示例5: create

 /**
  * Create an organizational unit
  *
  * @param array $attributes Default attributes of the ou
  * @return bool
  */
 public function create($attributes)
 {
     if (!is_array($attributes)) {
         return "Attributes must be an array";
     }
     if (!is_array($attributes["container"])) {
         return "Container attribute must be an array.";
     }
     if (!array_key_exists("ou_name", $attributes)) {
         return "Missing compulsory field [ou_name]";
     }
     if (!array_key_exists("container", $attributes)) {
         return "Missing compulsory field [container]";
     }
     $attributes["container"] = array_reverse($attributes["container"]);
     $add = array();
     $add["objectClass"] = "organizationalUnit";
     $add["OU"] = $attributes['ou_name'];
     $containers = "";
     if (count($attributes['container']) > 0) {
         $containers = "OU=" . implode(",OU=", $attributes["container"]) . ",";
     }
     $containers = "OU=" . implode(",OU=", $attributes["container"]);
     $result = ldap_add($this->adldap->getLdapConnection(), "OU=" . $add["OU"] . ", " . $containers . $this->adldap->getBaseDn(), $add);
     if ($result != true) {
         return false;
     }
     return true;
 }
开发者ID:jotttt,项目名称:ttu-wiki,代码行数:35,代码来源:adLDAPFolders.php

示例6: cn

 /**
  * Coping with AD not returning the primary group
  * http://support.microsoft.com/?kbid=321360 
  * 
  * For some reason it's not possible to search on primarygrouptoken=XXX
  * If someone can show otherwise, I'd like to know about it :)
  * this way is resource intensive and generally a pain in the @#%^
  * 
  * @deprecated deprecated since version 3.1, see get get_primary_group
  * @param string $gid Group ID
  * @return string
  */
 public function cn($gid)
 {
     if ($gid === NULL) {
         return false;
     }
     $r = false;
     $filter = "(&(objectCategory=group)(samaccounttype=" . adLDAP::ADLDAP_SECURITY_GLOBAL_GROUP . "))";
     $fields = array("primarygrouptoken", "samaccountname", "distinguishedname");
     $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
     $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
     for ($i = 0; $i < $entries["count"]; $i++) {
         if ($entries[$i]["primarygrouptoken"][0] == $gid) {
             $r = $entries[$i]["distinguishedname"][0];
             $i = $entries["count"];
         }
     }
     return $r;
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:30,代码来源:adLDAPGroups.php

示例7: create

 /**
  * Créé un ordinateur dans l'ad
  * @param array $attributes
  * @return string|boolean
  */
 public function create($attributes)
 {
     // Check for compulsory fields
     if (!array_key_exists("cn", $attributes)) {
         return "Missing compulsory field [username]";
     }
     if (!array_key_exists("container", $attributes)) {
         return "Missing compulsory field [container]";
     }
     if (!is_array($attributes["container"])) {
         return "Container attribute must be an array.";
     }
     // Translate the schema
     //  $add = $this->adldap->adldap_schema($attributes);
     // Additional stuff only used for adding accounts
     $add["cn"][0] = $attributes["cn"];
     $add["sAMAccountName"][0] = $attributes["cn"] . "\$";
     $add["objectClass"][0] = "top";
     $add["objectClass"][1] = "person";
     $add["objectClass"][2] = "organizationalPerson";
     $add["objectClass"][3] = "user";
     //person?
     $add["objectClass"][4] = "computer";
     //$add["name"][0]=$attributes["firstname"]." ".$attributes["surname"];
     // Set the account control attribute
     $control_options = array("WORKSTATION_TRUST_ACCOUNT");
     $add["userAccountControl"][0] = $this->accountControl($control_options);
     // Determine the container
     $attributes["container"] = array_reverse($attributes["container"]);
     //$container = "OU=" . implode(",OU= ",$attributes["container"]);
     $container = "CN=" . implode(",CN= ", $attributes["container"]);
     // Add the entry
     $result = @ldap_add($this->adldap->getLdapConnection(), "CN=" . $add["cn"][0] . "," . $container . "," . $this->adldap->getBaseDn(), $add);
     if ($result != true) {
         return false;
     }
     return true;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:43,代码来源:adLDAPComputers.php


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