limit namespaces based on id type, quote userinvitation emails

This commit is contained in:
Jay Lee
2021-03-18 15:43:07 -04:00
parent aaed2a6d86
commit 0eee6979b0
2 changed files with 19 additions and 13 deletions

View File

@ -53,16 +53,6 @@ def print_policies():
msg = f'{myarg} is not a valid argument to "gam print chromepolicy"'
controlflow.system_error_exit(3, msg)
orgunit = _get_orgunit(orgunit)
namespaces = [
'chrome.users',
# 'chrome.users.apps',
# 'chrome.devices',
# 'chrome.devices.managedGuest',
# 'chrome.devices.managedGuest.apps',
# 'chrome.devices.kiosk',
# 'chrome.devices.kiosk.apps',
'chrome.printers',
]
body = {
'policyTargetKey': {
'targetResource': orgunit,
@ -70,8 +60,20 @@ def print_policies():
}
if printer_id:
body['policyTargetKey']['additionalTargetKeys'] = {'printer_id': printer_id}
namespaces = ['chrome.printers']
elif app_id:
body['policyTargetKey']['additionalTargetKeys'] = {'app_id': app_id}
namespaces = ['chrome.users.apps',
'chrome.devices.managedGuest.apps',
'chrome.devices.kiosk.apps']
else:
namespaces = [
'chrome.users',
# Not yet implemented:
# 'chrome.devices',
# 'chrome.devices.managedGuest',
# 'chrome.devices.kiosk',
]
throw_reasons = [gapi_errors.ErrorReason.FOUR_O_O,]
for namespace in namespaces:
body['policySchemaFilter'] = f'{namespace}.*'