mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-05 05:11:35 +00:00
Merge branch 'master' of https://github.com/jay0lee/GAM
This commit is contained in:
34
src/gam.py
34
src/gam.py
@@ -506,7 +506,9 @@ def SetGlobalVariables():
|
|||||||
if not filterVal:
|
if not filterVal:
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
column, filterStr = filterVal.split(':', 1)
|
filterTokens = shlexSplitList(filterVal, ':')
|
||||||
|
column = filterTokens[0]
|
||||||
|
filterStr = ':'.join(filterTokens[1:])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
controlflow.system_error_exit(3, 'Item: {0}, Value: "{1}", Expected column:filter'.format(itemName, filterVal))
|
controlflow.system_error_exit(3, 'Item: {0}, Value: "{1}", Expected column:filter'.format(itemName, filterVal))
|
||||||
filterDict[column] = filterStr
|
filterDict[column] = filterStr
|
||||||
@@ -10680,16 +10682,6 @@ def getOrgUnitItem(orgUnit, pathOnly=False, absolutePath=True):
|
|||||||
return makeOrgUnitPathAbsolute(orgUnit)
|
return makeOrgUnitPathAbsolute(orgUnit)
|
||||||
return makeOrgUnitPathRelative(orgUnit)
|
return makeOrgUnitPathRelative(orgUnit)
|
||||||
|
|
||||||
def getOrgUnitId(orgUnit, cd=None):
|
|
||||||
if cd is None:
|
|
||||||
cd = buildGAPIObject('directory')
|
|
||||||
orgUnit = getOrgUnitItem(orgUnit)
|
|
||||||
if orgUnit[:3] == 'id:':
|
|
||||||
return (orgUnit, orgUnit)
|
|
||||||
result = gapi.call(cd.orgunits(), 'get',
|
|
||||||
customerId=GC_Values[GC_CUSTOMER_ID], orgUnitPath=encodeOrgUnitPath(makeOrgUnitPathRelative(orgUnit)), fields='orgUnitId')
|
|
||||||
return (orgUnit, result['orgUnitId'])
|
|
||||||
|
|
||||||
def getTopLevelOrgId(cd, orgUnitPath):
|
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)
|
||||||
@@ -10702,6 +10694,26 @@ def getTopLevelOrgId(cd, orgUnitPath):
|
|||||||
pass
|
pass
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def getOrgUnitId(orgUnit, cd=None):
|
||||||
|
if cd is None:
|
||||||
|
cd = buildGAPIObject('directory')
|
||||||
|
orgUnit = getOrgUnitItem(orgUnit)
|
||||||
|
if orgUnit[:3] == 'id:':
|
||||||
|
return (orgUnit, orgUnit)
|
||||||
|
if orgUnit == '/':
|
||||||
|
result = gapi.call(cd.orgunits(), 'list',
|
||||||
|
customerId=GC_Values[GC_CUSTOMER_ID], orgUnitPath='/', type='children',
|
||||||
|
fields='organizationUnits(parentOrgUnitId)')
|
||||||
|
if result.get('organizationUnits', []):
|
||||||
|
return (orgUnit, result['organizationUnits'][0]['parentOrgUnitId'])
|
||||||
|
topLevelOrgId = getTopLevelOrgId(cd, '/')
|
||||||
|
if topLevelOrgId:
|
||||||
|
return (orgUnit, topLevelOrgId)
|
||||||
|
return (orgUnit, '/') #Bogus but should never happen
|
||||||
|
result = gapi.call(cd.orgunits(), 'get',
|
||||||
|
customerId=GC_Values[GC_CUSTOMER_ID], orgUnitPath=encodeOrgUnitPath(makeOrgUnitPathRelative(orgUnit)), fields='orgUnitId')
|
||||||
|
return (orgUnit, result['orgUnitId'])
|
||||||
|
|
||||||
def doGetOrgInfo(name=None, return_attrib=None):
|
def doGetOrgInfo(name=None, return_attrib=None):
|
||||||
cd = buildGAPIObject('directory')
|
cd = buildGAPIObject('directory')
|
||||||
checkSuspended = None
|
checkSuspended = None
|
||||||
|
|||||||
Reference in New Issue
Block a user