mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 15:40:01 -06:00
fdfde9ce52
From now on, new users/groups automatically get a SID. Update the expect test outputs. Related: https://pagure.io/freeipa/issue/8995 Signed-off-by: Florence Blanc-Renaud <flo@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
# coding: utf-8
|
|
#
|
|
# Copyright (C) 2016 FreeIPA Contributors see COPYING for license
|
|
#
|
|
import six
|
|
|
|
from ipalib import api
|
|
|
|
|
|
def get_range_dn(name):
|
|
format_str = "cn={name},cn=ranges,cn=etc,{basedn}"
|
|
data = dict(name=name, basedn=api.env.basedn)
|
|
return format_str.format(**data)
|
|
|
|
|
|
def get_trust_dn(name):
|
|
format_str = "cn={name},cn=ad,cn=trusts,{basedn}"
|
|
data = dict(name=name, basedn=api.env.basedn)
|
|
return format_str.format(**data)
|
|
|
|
|
|
def encode_mockldap_value(value):
|
|
value = str(value)
|
|
if six.PY3:
|
|
return value.encode('utf-8')
|
|
else:
|
|
return value
|
|
|
|
|
|
def get_trusted_dom_range_dict(name, base_id, size, rangetype, base_rid, sid):
|
|
return dict(
|
|
objectClass=[b"ipaIDrange", b"ipatrustedaddomainrange"],
|
|
ipaBaseID=encode_mockldap_value("{base_id}".format(base_id=base_id)),
|
|
ipaBaseRID=encode_mockldap_value("{base_rid}".format(base_rid=base_rid)),
|
|
ipaIDRangeSize=encode_mockldap_value("{size}".format(size=size)),
|
|
ipaNTTrustedDomainSID=encode_mockldap_value("{sid}".format(sid=sid)),
|
|
ipaRangeType=encode_mockldap_value("{rangetype}".format(rangetype=rangetype)),
|
|
)
|
|
|
|
|
|
def get_trusted_dom_dict(name, sid):
|
|
return dict(
|
|
objectClass=[b"ipaNTTrustedDomain", b"ipaIDobject", b"top"],
|
|
ipaNTFlatName=encode_mockldap_value(name.split('.')[0].upper()),
|
|
ipaNTTrustedDomainSID=encode_mockldap_value(sid),
|
|
ipaNTSIDBlacklistIncoming=b'S-1-0',
|
|
ipaNTTrustPartner=encode_mockldap_value('{name}.mock'.format(name=name)),
|
|
ipaNTTrustType=b'2',
|
|
ipaNTTrustDirection=b'3',
|
|
ipaNTTrustAttributes=b'8',
|
|
)
|