コード例 #1
0
ファイル: ldapfilter.py プロジェクト: wiml/ldaptor
def _p_extensible(s, l, t):
    attr, dn, matchingRule, value = t
    return pureldap.LDAPFilter_extensibleMatch(
        matchingRule=matchingRule,
        type=attr,
        matchValue=value,
        dnAttributes=dn)
コード例 #2
0
 def test_extensible_5(self):
     text = '(cn:1.2.3.4.5:=Fred Flintstone)'
     filt = pureldap.LDAPFilter_extensibleMatch(
         type='cn',
         dnAttributes=None,
         matchingRule='1.2.3.4.5',
         matchValue='Fred Flintstone',
         )
     self.assertEqual(filt.asText(), text)
コード例 #3
0
 def test_extensible_5(self):
     text = "(cn:1.2.3.4.5:=Fred Flintstone)"
     filt = pureldap.LDAPFilter_extensibleMatch(
         type="cn",
         dnAttributes=None,
         matchingRule="1.2.3.4.5",
         matchValue="Fred Flintstone",
     )
     self.assertEqual(filt.asText(), text)
コード例 #4
0
 def test_extensible_3(self):
     text = "(o:dn:=Ace Industry)"
     filt = pureldap.LDAPFilter_extensibleMatch(
         type="o",
         dnAttributes=True,
         matchingRule=None,
         matchValue="Ace Industry",
     )
     self.assertEqual(ldapfilter.parseFilter(text), filt)
     self.assertEqual(filt.asText(), text)
コード例 #5
0
 def test_extensible_2(self):
     text = "(sn:dn:2.4.6.8.10:=Barney Rubble)"
     filt = pureldap.LDAPFilter_extensibleMatch(
         type="sn",
         dnAttributes=True,
         matchingRule="2.4.6.8.10",
         matchValue="Barney Rubble",
     )
     self.assertEqual(ldapfilter.parseFilter(text), filt)
     self.assertEqual(filt.asText(), text)
コード例 #6
0
 def test_extensible_4(self):
     text = "(:dn:2.4.6.8.10:=Dino)"
     filt = pureldap.LDAPFilter_extensibleMatch(
         type=None,
         dnAttributes=True,
         matchingRule="2.4.6.8.10",
         matchValue="Dino",
     )
     self.assertEqual(ldapfilter.parseFilter(text), filt)
     self.assertEqual(filt.asText(), text)
コード例 #7
0
ファイル: test_ldapfilter.py プロジェクト: wiml/ldaptor
 def test_extensible_4(self):
     text = '(:dn:2.4.6.8.10:=Dino)'
     self.assertEqual(
         ldapfilter.parseFilter(text),
         pureldap.LDAPFilter_extensibleMatch(
             type=None,
             dnAttributes=True,
             matchingRule='2.4.6.8.10',
             matchValue='Dino',
         ))
コード例 #8
0
ファイル: test_ldapfilter.py プロジェクト: wiml/ldaptor
 def test_extensible_3(self):
     text = '(o:dn:=Ace Industry)'
     self.assertEqual(
         ldapfilter.parseFilter(text),
         pureldap.LDAPFilter_extensibleMatch(
             type='o',
             dnAttributes=True,
             matchingRule=None,
             matchValue='Ace Industry',
         ))
コード例 #9
0
ファイル: test_ldapfilter.py プロジェクト: wiml/ldaptor
 def test_extensible_2(self):
     text = '(sn:dn:2.4.6.8.10:=Barney Rubble)'
     self.assertEqual(
         ldapfilter.parseFilter(text),
         pureldap.LDAPFilter_extensibleMatch(
             type='sn',
             dnAttributes=True,
             matchingRule='2.4.6.8.10',
             matchValue='Barney Rubble',
         ))
コード例 #10
0
ファイル: test_ldapfilter.py プロジェクト: wiml/ldaptor
 def test_extensible_1(self):
     text = '(cn:1.2.3.4.5:=Fred Flintstone)'
     self.assertEqual(
         ldapfilter.parseFilter(text),
         pureldap.LDAPFilter_extensibleMatch(
             type='cn',
             dnAttributes=False,
             matchingRule='1.2.3.4.5',
             matchValue='Fred Flintstone',
         ))
コード例 #11
0
 def test_extensibleMatch4_noMatch(self):
     """
     An extensibleMatch filter that uses DN attributes does not match an entry
     based on its OU.
     See RFC4511 section 4.5.1.
     """
     m = pureldap.LDAPFilter_extensibleMatch(
         matchingRule=None,
         type=pureldap.LDAPMatchingRuleAssertion_type(value='ou'),
         matchValue=pureldap.LDAPMatchingRuleAssertion_matchValue(
             value='fings'),
         dnAttributes=pureldap.LDAPMatchingRuleAssertion_dnAttributes(
             value=255))
     o = inmemory.ReadOnlyInMemoryLDAPEntry(
         dn='cn=foo,ou=uvvers,dc=example,dc=com',
         attributes={
             'objectClass': ['a', 'b'],
             'aValue': ['b'],
             'num': [4],
         })
     result = o.match(m)
     self.assertEqual(result, False)
コード例 #12
0
 def test_extensibleMatch4_noMatch(self):
     """
     An extensibleMatch filter that uses DN attributes does not match an entry
     based on its OU.
     See RFC4511 section 4.5.1.
     """
     m = pureldap.LDAPFilter_extensibleMatch(
         matchingRule=None,
         type=pureldap.LDAPMatchingRuleAssertion_type(value="ou"),
         matchValue=pureldap.LDAPMatchingRuleAssertion_matchValue(
             value="fings"),
         dnAttributes=pureldap.LDAPMatchingRuleAssertion_dnAttributes(
             value=255),
     )
     o = inmemory.ReadOnlyInMemoryLDAPEntry(
         dn="cn=foo,ou=uvvers,dc=example,dc=com",
         attributes={
             "objectClass": ["a", "b"],
             "aValue": ["b"],
             "num": [4],
         },
     )
     result = o.match(m)
     self.assertEqual(result, False)