def normalizeCalendarId(calname, checkPrimary=False): if checkPrimary and calname.lower() == 'primary': return calname if not GC_Values[GC_DOMAIN]: GC_Values[GC_DOMAIN] = __main__._getValueFromOAuth('hd') return __main__.convertUIDtoEmailAddress(calname, email_types=['user', 'resource'])
def getHoldInfo(): v = buildGAPIObject() hold = sys.argv[3] matterId = None i = 4 while i < len(sys.argv): myarg = sys.argv[i].lower().replace('_', '') if myarg == 'matter': matterId = getMatterItem(v, sys.argv[i+1]) holdId = convertHoldNameToID(v, hold, matterId) i += 2 else: controlflow.invalid_argument_exit(myarg, "gam info hold") if not matterId: controlflow.system_error_exit( 3, 'you must specify a matter for the hold.') results = gapi.call(v.matters().holds(), 'get', matterId=matterId, holdId=holdId) cd = __main__.buildGAPIObject('directory') if 'accounts' in results: account_type = 'group' if results['corpus'] == 'GROUPS' else 'user' for i in range(0, len(results['accounts'])): uid = f'uid:{results["accounts"][i]["accountId"]}' acct_email = __main__.convertUIDtoEmailAddress( uid, cd, [account_type]) results['accounts'][i]['email'] = acct_email if 'orgUnit' in results: results['orgUnit']['orgUnitPath'] = __main__.doGetOrgInfo( results['orgUnit']['orgUnitId'], return_attrib='orgUnitPath') display.print_json(results)
def getMatterInfo(): v = buildGAPIObject() matterId = getMatterItem(v, sys.argv[3]) result = gapi.call(v.matters(), 'get', matterId=matterId, view='FULL') if 'matterPermissions' in result: cd = __main__.buildGAPIObject('directory') for i in range(0, len(result['matterPermissions'])): uid = f'uid:{result["matterPermissions"][i]["accountId"]}' user_email = __main__.convertUIDtoEmailAddress(uid, cd) result['matterPermissions'][i]['email'] = user_email display.print_json(result)