mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 20:31:35 +00:00
gotTopLevelOrg must take orgUnitPath as parameter (#527)
THis is required in doPrintOrgs when fromparent is used.
This commit is contained in:
@@ -8510,11 +8510,11 @@ def orgUnitPathQuery(path):
|
|||||||
return u"orgUnitPath='{0}'".format(path.replace(u"'", u"\'"))
|
return u"orgUnitPath='{0}'".format(path.replace(u"'", u"\'"))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def getTopLevelOrgId(cd):
|
def getTopLevelOrgId(cd, orgUnitPath):
|
||||||
try:
|
try:
|
||||||
# create a temp org so we can learn what the top level org ID is (sigh)
|
# create a temp org so we can learn what the top level org ID is (sigh)
|
||||||
temp_org = callGAPI(cd.orgunits(), u'insert', customerId=GC_Values[GC_CUSTOMER_ID],
|
temp_org = callGAPI(cd.orgunits(), u'insert', customerId=GC_Values[GC_CUSTOMER_ID],
|
||||||
body={u'name': u'temp-delete-me', u'parentOrgUnitPath': u'/'},
|
body={u'name': u'temp-delete-me', u'parentOrgUnitPath': orgUnitPath},
|
||||||
fields=u'parentOrgUnitId,orgUnitId')
|
fields=u'parentOrgUnitId,orgUnitId')
|
||||||
callGAPI(cd.orgunits(), u'delete', customerId=GC_Values[GC_CUSTOMER_ID], orgUnitPath=temp_org[u'orgUnitId'])
|
callGAPI(cd.orgunits(), u'delete', customerId=GC_Values[GC_CUSTOMER_ID], orgUnitPath=temp_org[u'orgUnitId'])
|
||||||
return temp_org[u'parentOrgUnitId']
|
return temp_org[u'parentOrgUnitId']
|
||||||
@@ -8546,7 +8546,7 @@ def doGetOrgInfo(name=None, return_attrib=None):
|
|||||||
if u'organizationUnits' in orgs and orgs[u'organizationUnits']:
|
if u'organizationUnits' in orgs and orgs[u'organizationUnits']:
|
||||||
name = orgs[u'organizationUnits'][0][u'parentOrgUnitId']
|
name = orgs[u'organizationUnits'][0][u'parentOrgUnitId']
|
||||||
else:
|
else:
|
||||||
topLevelOrgId = getTopLevelOrgId(cd)
|
topLevelOrgId = getTopLevelOrgId(cd, u'/')
|
||||||
if topLevelOrgId:
|
if topLevelOrgId:
|
||||||
name = topLevelOrgId
|
name = topLevelOrgId
|
||||||
if len(name) > 1 and name[0] == u'/':
|
if len(name) > 1 and name[0] == u'/':
|
||||||
@@ -9487,7 +9487,7 @@ def doPrintOrgs():
|
|||||||
orgs = callGAPI(cd.orgunits(), u'list',
|
orgs = callGAPI(cd.orgunits(), u'list',
|
||||||
customerId=GC_Values[GC_CUSTOMER_ID], type=listType, orgUnitPath=orgUnitPath, fields=list_fields)
|
customerId=GC_Values[GC_CUSTOMER_ID], type=listType, orgUnitPath=orgUnitPath, fields=list_fields)
|
||||||
if not u'organizationUnits' in orgs:
|
if not u'organizationUnits' in orgs:
|
||||||
topLevelOrgId = getTopLevelOrgId(cd)
|
topLevelOrgId = getTopLevelOrgId(cd, orgUnitPath)
|
||||||
if topLevelOrgId:
|
if topLevelOrgId:
|
||||||
parentOrgIds.append(topLevelOrgId)
|
parentOrgIds.append(topLevelOrgId)
|
||||||
orgunits = []
|
orgunits = []
|
||||||
|
|||||||
Reference in New Issue
Block a user