mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
tests/krb5: Add functions to fetch the schemaIDGUID of an attribute or class
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
1b5c57c305
commit
fd64bae7b4
@ -383,23 +383,34 @@ class KDCBaseTest(RawKerberosTest):
|
||||
return dn
|
||||
|
||||
def get_dn_from_attribute(self, attribute):
|
||||
return self.get_dn_from_schema(attribute, 'attributeSchema')
|
||||
return self.get_from_attribute(attribute).dn
|
||||
|
||||
def get_dn_from_class(self, attribute):
|
||||
return self.get_dn_from_schema(attribute, 'classSchema')
|
||||
return self.get_from_class(attribute).dn
|
||||
|
||||
def get_dn_from_schema(self, name, object_class):
|
||||
def get_schema_id_guid_from_attribute(self, attribute):
|
||||
guid = self.get_from_attribute(attribute).get('schemaIDGUID', idx=0)
|
||||
return misc.GUID(guid)
|
||||
|
||||
def get_from_attribute(self, attribute):
|
||||
return self.get_from_schema(attribute, 'attributeSchema')
|
||||
|
||||
def get_from_class(self, attribute):
|
||||
return self.get_from_schema(attribute, 'classSchema')
|
||||
|
||||
def get_from_schema(self, name, object_class):
|
||||
samdb = self.get_samdb()
|
||||
schema_dn = samdb.get_schema_basedn()
|
||||
|
||||
res = samdb.search(base=schema_dn,
|
||||
scope=ldb.SCOPE_ONELEVEL,
|
||||
attrs=['schemaIDGUID'],
|
||||
expression=(f'(&(objectClass={object_class})'
|
||||
f'(lDAPDisplayName={name}))'))
|
||||
self.assertEqual(1, len(res),
|
||||
f'could not locate {name} in {object_class}')
|
||||
|
||||
return res[0].dn
|
||||
return res[0]
|
||||
|
||||
def create_claim(self,
|
||||
claim_id,
|
||||
|
Loading…
Reference in New Issue
Block a user