diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3227755e..19e74d4c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,22 +49,22 @@ jobs: goal: build arch: Win32 openssl_archs: VC-WIN32 - - os: ubuntu-20.04 + - os: ubuntu-22.04 goal: test python: "3.7" jid: 7 arch: x86_64 - - os: ubuntu-20.04 + - os: ubuntu-22.04 goal: test python: "3.8" jid: 8 arch: x86_64 - - os: ubuntu-20.04 + - os: ubuntu-22.04 goal: test python: "3.9" jid: 9 arch: x86_64 - - os: ubuntu-20.04 + - os: ubuntu-22.04 goal: test python: "3.11-dev" jid: 10 @@ -82,7 +82,7 @@ jobs: with: path: | bin - key: gam-${{ matrix.jid }}-20220525 + key: gam-${{ matrix.jid }}-20220621 - name: Use pre-compiled Python for testing if: matrix.python != '' @@ -628,7 +628,7 @@ jobs: $gam print vaultmatters matterstate open $gam print vaultholds matter $matterid $gam print vaultcount matter $matterid corpus mail everyone todrive - $gam create vaultexport matter $matterid name "GHA export $newbase" corpus mail accounts $newuser use_new_export true + $gam create vaultexport matter $matterid name "GHA export $newbase" corpus mail accounts $newuser use_new_export false $gam print exports matter $matterid | $gam csv - gam info export $matterid id:~~id~~ $gam csv sample.csv gam user ~email add calendar id:$newresource $gam delete resource $newresource diff --git a/src/GamCommands.txt b/src/GamCommands.txt index e5ccf6a6..f35415a2 100644 --- a/src/GamCommands.txt +++ b/src/GamCommands.txt @@ -682,12 +682,19 @@ Specify a collection of Users by directly specifying them or by specifying items ## Item attributes ::= + (address|addresslines )| + (city|locality )| + (country|regioncode )| (description )| (floors )| (id )| + (language|languageCode )| (latitude )| (longitude )| (name ) + (state|administrativearea )| + (sublocality )| + (zipcode|postalcode ) ::= (selected )|(hidden )|(summary )|(colorindex|colorid )|(backgroundcolor )|(foregroundcolor )| @@ -1839,7 +1846,7 @@ gam update teamdrive |(name ) [asad [(theme|themeid ) | ([customtheme ] [color ])] ( )* [hidden ] -gam delete teamdrive |(name ) [allowitemdeletion|nukefromorbit] +gam delete teamdrive |(name ) [asadmin] [allowitemdeletion|nukefromorbit] gam show teamdriveinfo |(name ) [asadmin] gam show teamdrives [query ] [asadmin] gam print teamdrives [query ] [todrive] [asadmin] diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 1c187ce1..fc2b4c34 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -8243,6 +8243,9 @@ def doDeleteSharedDrive(users): allowItemDeletion = True useDomainAdminAccess = True i += 1 + elif myarg == 'asadmin': + useDomainAdminAccess = True + i += 1 else: controlflow.invalid_argument_exit( myarg, 'gam delete shareddrive') diff --git a/src/gam/gapi/directory/orgunits.py b/src/gam/gapi/directory/orgunits.py index 6be28893..ef0b404d 100644 --- a/src/gam/gapi/directory/orgunits.py +++ b/src/gam/gapi/directory/orgunits.py @@ -373,17 +373,20 @@ def makeOrgUnitPathRelative(path): def encodeOrgUnitPath(path): - if path.find('+') == -1 and path.find('%') == -1: - return path - encpath = '' - for c in path: - if c == '+': - encpath += '%2B' - elif c == '%': - encpath += '%25' - else: - encpath += c - return encpath +# 6.22 - This method no longer works. +# % no longer needs encoding and + is handled incorrectly in API with or without encoding + return path +# if path.find('+') == -1 and path.find('%') == -1: +# return path +# encpath = '' +# for c in path: +# if c == '+': +# encpath += '%2B' +# elif c == '%': +# encpath += '%25' +# else: +# encpath += c +# return encpath def getOrgUnitItem(orgUnit, pathOnly=False, absolutePath=True): diff --git a/src/gam/gapi/directory/resource.py b/src/gam/gapi/directory/resource.py index a7b81f78..eb744934 100644 --- a/src/gam/gapi/directory/resource.py +++ b/src/gam/gapi/directory/resource.py @@ -227,6 +227,22 @@ def printFeatures(): display.write_csv_file(csvRows, titles, 'Features', to_drive) +BUILDING_ADDRESS_FIELD_MAP = { + 'address': 'addressLines', + 'addresslines': 'addressLines', + 'administrativearea': 'administrativeArea', + 'city': 'locality', + 'country': 'regionCode', + 'language': 'languageCode', + 'languagecode': 'languageCode', + 'locality': 'locality', + 'postalcode': 'postalCode', + 'regioncode': 'regionCode', + 'state': 'administrativeArea', + 'sublocality': 'sublocality', + 'zipcode': 'postalCode', + } + def _getBuildingAttributes(args, body={}): i = 0 while i < len(args): @@ -253,6 +269,16 @@ def _getBuildingAttributes(args, body={}): elif myarg == 'floors': body['floorNames'] = args[i + 1].split(',') i += 2 + elif myarg in BUILDING_ADDRESS_FIELD_MAP: + myarg = BUILDING_ADDRESS_FIELD_MAP[myarg] + body.setdefault('address', {}) + if myarg == 'addressLines': + body['address'][myarg] = args[i + 1].split('\n') + elif myarg == 'languageCode': + body['address'][myarg] = LANGUAGE_CODES_MAP.get(args[i + 1].lower(), args[i + 1]) + else: + body['address'][myarg] = args[i + 1] + i += 2 else: controlflow.invalid_argument_exit(myarg, 'gam create|update building') diff --git a/src/gam/gapi/directory/roleassignments.py b/src/gam/gapi/directory/roleassignments.py index 2248e611..8648389a 100644 --- a/src/gam/gapi/directory/roleassignments.py +++ b/src/gam/gapi/directory/roleassignments.py @@ -27,7 +27,7 @@ def create(): body['scopeType']) if body['scopeType'] == 'ORG_UNIT': orgUnit, orgUnitId = gapi_directory_orgunits.getOrgUnitId( - sys.argv[6], cd) + sys.argv[i], cd) body['orgUnitId'] = orgUnitId[3:] scope = f'ORG_UNIT {orgUnit}' i = 7