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


PHP Zend_Ldap::update方法代碼示例

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


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

示例1: _saveUser

 /**
  * This function takes care of actually saving the user data into LDAP
  * @param String $userId
  * @param array $data
  */
 protected function _saveUser($userId, $data)
 {
     if ($this->userExists($userId)) {
         $this->_ldap->update($this->_getDNForUserId($userId), $data);
     } else {
         $this->_ldap->add($this->_getDNForUserId($userId), $data);
     }
     return true;
 }
開發者ID:RKathees,項目名稱:is-connectors,代碼行數:14,代碼來源:Ldap.php

示例2: update

 /**
  * Update record data in the backend with passed data object properties values 
  *
  * @param t41_Data_Object $do
  * @return boolean
  */
 public function update(ObjectModel\DataObject $do)
 {
     // Properties mapping (to array)
     if ($this->_mapper) {
         $data = $do->map($this->_mapper, $do->getClass());
     } else {
         $data = $do->toArray();
     }
     $data = $this->_unflattenArray($data);
     return (bool) $this->_ressource->update($do->getUri()->getIdentifier(), $data);
 }
開發者ID:crapougnax,項目名稱:t41,代碼行數:17,代碼來源:LdapAdapter.php

示例3: _updateUser

 protected function _updateUser($user, $newAttributes)
 {
     // Hackish, apparently LDAP gives us arrays even for single values?
     // So for now we assume arrays with only one value are single valued
     foreach ($user as $userKey => $userValue) {
         if (is_array($userValue) && count($userValue) === 1) {
             $user[$userKey] = $userValue[0];
         }
     }
     if ($user[self::LDAP_ATTR_COLLAB_PERSON_HASH] === $this->_getCollabPersonHash($newAttributes)) {
         $now = date(DATE_RFC822);
         $newAttributes = $user + $newAttributes;
         $newAttributes[self::LDAP_ATTR_COLLAB_PERSON_LAST_ACCESSED] = $now;
         return $newAttributes;
     }
     $newAttributes[self::LDAP_ATTR_COLLAB_PERSON_HASH] = $this->_getCollabPersonHash($newAttributes);
     $now = date(DATE_RFC822);
     $newAttributes = array_merge($user, $newAttributes);
     $newAttributes[self::LDAP_ATTR_COLLAB_PERSON_LAST_ACCESSED] = $now;
     $newAttributes[self::LDAP_ATTR_COLLAB_PERSON_LAST_UPDATED] = $now;
     $dn = $this->_getDnForLdapAttributes($newAttributes);
     $this->_ldapClient->update($dn, $newAttributes);
     return $newAttributes;
 }
開發者ID:WebSpider,項目名稱:OpenConext-engineblock,代碼行數:24,代碼來源:UserDirectory.php

示例4: array

 *
 * @var $this       DbPatch_Command_Patch_PHP
 * @var $writer     DbPatch_Core_Writer
 * @var $db         Zend_Db_Adapter_Abstract
 * @var $phpFile    string
 */
$ldapConfig = EngineBlock_ApplicationSingleton::getInstance()->getConfiguration()->ldap;
$ldapOptions = array('host' => $ldapConfig->host, 'useSsl' => $ldapConfig->useSsl, 'username' => $ldapConfig->userName, 'password' => $ldapConfig->password, 'bindRequiresDn' => $ldapConfig->bindRequiresDn, 'accountDomainName' => $ldapConfig->accountDomainName, 'baseDn' => $ldapConfig->baseDn);
$ldapClient = new Zend_Ldap($ldapOptions);
$ldapClient->bind();
$writer->info("Retrieving all collabPerson entries from LDAP");
//$filter = '(&(objectclass=collabPerson))';
$filter = '(&(objectclass=collabPerson)(!(collabPersonUUID=*)))';
$users = $ldapClient->search($filter);
while (count($users) > 0) {
    $writer->info("Retrieved " . count($users) . " users from LDAP");
    foreach ($users as $user) {
        foreach ($user as $userKey => $userValue) {
            if (is_array($userValue) && count($userValue) === 1) {
                $user[$userKey] = $userValue[0];
            }
        }
        $user['collabpersonuuid'] = (string) Surfnet_Zend_Uuid::generate();
        $now = date(DATE_RFC822);
        $user['collabpersonlastupdated'] = $now;
        $dn = 'uid=' . $user['uid'] . ',o=' . $user['o'] . ',' . $ldapClient->getBaseDn();
        $ldapClient->update($dn, $user);
        $writer->info("Set UUID '{$user['collabpersonuuid']}' for DN: '{$dn}'");
    }
    $users = $ldapClient->search($filter);
}
開發者ID:WebSpider,項目名稱:OpenConext-engineblock,代碼行數:31,代碼來源:patch-0010.php


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