original_string: protected function _checkGroupMembership(Zend_Ldap $ldap, $canonicalName, $dn, array $adapterOptions)
      {
          if ($adapterOptions['group'] === null) {
              return true;
          }
  
          if ($adapterOptions['memberIsDn'] === false) {
              $user = $canonicalName;
          } else {
              $user = $dn;
          }
  
          /**
           * @see Zend_Ldap_Filter
           */
          require_once 'Zend/Ldap/Filter.php';
          $groupName = Zend_Ldap_Filter::equals($adapterOptions['groupAttr'], $adapterOptions['group']);
          $membership = Zend_Ldap_Filter::equals($adapterOptions['memberAttr'], $user);
          $group = Zend_Ldap_Filter::andFilter($groupName, $membership);
          $groupFilter = $adapterOptions['groupFilter'];
          if (!empty($groupFilter)) {
              $group = $group->addAnd($groupFilter);
          }
  
          $result = $ldap->count($group, $adapterOptions['groupDn'], $adapterOptions['groupScope']);
  
          if ($result === 1) {
              return true;
          } else {
              return 'Failed to verify group membership with ' . $group->toString();
          }
      }
code: protected function _checkGroupMembership(Zend_Ldap $ldap, $canonicalName, $dn, array $adapterOptions)
      {
          if ($adapterOptions['group'] === null) {
              return true;
          }
  
          if ($adapterOptions['memberIsDn'] === false) {
              $user = $canonicalName;
          } else {
              $user = $dn;
          }
  
          /**
           * @see Zend_Ldap_Filter
           */
          require_once 'Zend/Ldap/Filter.php';
          $groupName = Zend_Ldap_Filter::equals($adapterOptions['groupAttr'], $adapterOptions['group']);
          $membership = Zend_Ldap_Filter::equals($adapterOptions['memberAttr'], $user);
          $group = Zend_Ldap_Filter::andFilter($groupName, $membership);
          $groupFilter = $adapterOptions['groupFilter'];
          if (!empty($groupFilter)) {
              $group = $group->addAnd($groupFilter);
          }
  
          $result = $ldap->count($group, $adapterOptions['groupDn'], $adapterOptions['groupScope']);
  
          if ($result === 1) {
              return true;
          } else {
              return 'Failed to verify group membership with ' . $group->toString();
          }
      }
code_tokens: protected function _checkGroupMembership ( Zend_Ldap $ ldap , $ canonicalName , $ dn , array $ adapterOptions ) { if ( $ adapterOptions [ 'group' ] === null ) { return true ; } if ( $ adapterOptions [ 'memberIsDn' ] === false ) { $ user = $ canonicalName ; } else { $ user = $ dn ; } /**
           * @see Zend_Ldap_Filter
           */ require_once 'Zend/Ldap/Filter.php' ; $ groupName = Zend_Ldap_Filter :: equals ( $ adapterOptions [ 'groupAttr' ] , $ adapterOptions [ 'group' ] ) ; $ membership = Zend_Ldap_Filter :: equals ( $ adapterOptions [ 'memberAttr' ] , $ user ) ; $ group = Zend_Ldap_Filter :: andFilter ( $ groupName , $ membership ) ; $ groupFilter = $ adapterOptions [ 'groupFilter' ] ; if ( ! empty ( $ groupFilter ) ) { $ group = $ group -> addAnd ( $ groupFilter ) ; } $ result = $ ldap -> count ( $ group , $ adapterOptions [ 'groupDn' ] , $ adapterOptions [ 'groupScope' ] ) ; if ( $ result === 1 ) { return true ; } else { return 'Failed to verify group membership with ' . $ group -> toString ( ) ; } }
docstring: Checks the group membership of the bound user
  
  @param  Zend_Ldap $ldap
  @param  string    $canonicalName
  @param  string    $dn
  @param  array     $adapterOptions
  @return string|true
docstring_tokens: Checks the group membership of the bound user