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


PHP Zend_Ldap::filterEscape方法代码示例

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


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

示例1: _getAccountFilter

 /**
  * @return string The LDAP search filter for matching directory accounts
  */
 protected function _getAccountFilter($acctname)
 {
     $this->_splitName($acctname, $dname, $aname);
     $accountFilterFormat = $this->_getAccountFilterFormat();
     $aname = Zend_Ldap::filterEscape($aname);
     if ($accountFilterFormat)
         return sprintf($accountFilterFormat, $aname);
     if (!$this->_bindRequiresDn) {
         // is there a better way to detect this?
         return "(&(objectClass=user)(sAMAccountName=$aname))";
     }
     return "(&(objectClass=posixAccount)(uid=$aname))";
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:16,代码来源:Ldap.php

示例2: _getGroupMetaData

 /**
  * returns ldap metadata of given group
  *
  * @param  int         $_groupId
  * @return array 
  * 
  * @todo remove obsolete code
  */
 protected function _getGroupMetaData($_groupId)
 {
     $groupId = Tinebase_Model_Group::convertGroupIdToInt($_groupId);
     $filter = Zend_Ldap_Filter::equals($this->_options['groupUUIDAttribute'], Zend_Ldap::filterEscape($groupId));
     $result = $this->_ldap->search($filter, $this->_options['groupsDn'], Zend_Ldap::SEARCH_SCOPE_SUB, array('objectclass', 'sambasid'))->getFirst();
     return $result;
     /*
     } catch (Tinebase_Exception_NotFound $e) {
         throw new Exception("group with id $groupId not found");
     }
     */
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:20,代码来源:Samba.php

示例3: getGroupMembershipsFromSyncBackend

 /**
  * get groupmemberships of user from sync backend
  * 
  * @param   Tinebase_Model_User|string  $_userId
  * @return  array  list of group ids
  */
 public function getGroupMembershipsFromSyncBackend($_userId)
 {
     $userId = $_userId instanceof Tinebase_Model_User ? $_userId->getId() : $_userId;
     // find user in AD and retrieve memberOf attribute
     $filter = Zend_Ldap_Filter::andFilter(Zend_Ldap_Filter::string($this->_userBaseFilter), Zend_Ldap_Filter::equals($this->_userUUIDAttribute, $this->_encodeAccountId($userId)));
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ldap search filter: ' . $filter);
     }
     $memberOfs = $this->getLdap()->search($filter, $this->_options['userDn'], $this->_userSearchScope, array('memberof', 'primarygroupid'))->getFirst();
     if ($memberOfs === null) {
         return array();
     }
     // resolve primary group id to dn
     $domainConfig = $this->getDomainConfiguration();
     $filter = Zend_Ldap_Filter::andFilter(Zend_Ldap_Filter::string($this->_groupBaseFilter), Zend_Ldap_Filter::equals('objectsid', Zend_Ldap::filterEscape($domainConfig['domainSidPlain'] . '-' . $memberOfs['primarygroupid'][0])));
     $group = $this->getLdap()->search($filter, $this->_options['groupsDn'], $this->_groupSearchScope, array($this->_groupUUIDAttribute))->getFirst();
     $memberships = array($this->_decodeGroupId($group[$this->_groupUUIDAttribute][0]));
     if (isset($memberOfs['memberof'])) {
         // resolve $this->_groupUUIDAttribute attribute
         $filter = new Zend_Ldap_Filter_Or(array());
         foreach ($memberOfs['memberof'] as $memberOf) {
             $filter = $filter->addFilter(Zend_Ldap_Filter::equals('distinguishedName', Zend_Ldap::filterEscape($memberOf)));
         }
         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
             Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ldap search filter: ' . $filter);
         }
         $groups = $this->getLdap()->search($filter, $this->_options['groupsDn'], $this->_groupSearchScope, array($this->_groupUUIDAttribute));
         foreach ($groups as $group) {
             $memberships[] = $this->_decodeGroupId($group[$this->_groupUUIDAttribute][0]);
         }
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' group memberships: ' . print_r($memberships, TRUE));
     }
     return array_unique($memberships);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:42,代码来源:ActiveDirectory.php

示例4: testFilterEscapeBasicOperation

 /**
  * @return void
  */
 public function testFilterEscapeBasicOperation()
 {
     $input = 'a*b(b)d\e/f';
     $expected = 'a\2ab\28b\29d\5ce\2ff';
     $this->assertEquals($expected, Zend_Ldap::filterEscape($input));
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:9,代码来源:OfflineTest.php

示例5: resolveUIdNumberToUUId

 public function resolveUIdNumberToUUId($_uidNumber)
 {
     if ($this->_userUUIDAttribute == 'uidnumber') {
         return $_uidNumber;
     }
     $filter = Zend_Ldap_Filter::equals('uidnumber', Zend_Ldap::filterEscape($_uidNumber));
     $userId = $this->_ldap->search($filter, $this->_baseDn, $this->_userSearchScope, array($this->_userUUIDAttribute))->getFirst();
     return $userId[$this->_userUUIDAttribute][0];
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:9,代码来源:Ldap.php

示例6: _getGroupSID

 /**
  * return sid of group
  * 
  * @param string  $_groupId
  * @return string the sid of the group 
  */
 protected function _getGroupSID($_groupId)
 {
     $ldapOptions = Tinebase_User::getBackendConfiguration();
     $filter = Zend_Ldap_Filter::equals($ldapOptions['groupUUIDAttribute'], Zend_Ldap::filterEscape($_groupId));
     $groups = $this->_ldap->search($filter, $ldapOptions['groupsDn'], Zend_Ldap::SEARCH_SCOPE_SUB, array('sambasid'));
     if (count($groups) == 0) {
         throw new Tinebase_Exception_NotFound('Group not found! Filter: ' . $filter->toString());
     }
     $group = $groups->getFirst();
     if (empty($group['sambasid'][0])) {
         throw new Tinebase_Exception_NotFound('Group has no sambaSID');
     }
     return $group['sambasid'][0];
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:20,代码来源:Samba.php


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