mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-25 16:41:35 +00:00
Add header to gam show chromepolicy to display OU and printerid/appid (#1341)
This commit is contained in:
@@ -76,6 +76,13 @@ def printshow_policies():
|
||||
# 'chrome.devices.kiosk',
|
||||
]
|
||||
throw_reasons = [gapi_errors.ErrorReason.FOUR_O_O,]
|
||||
orgunitPath = gapi_directory_orgunits.orgunit_from_orgunitid(orgunit[9:], None)
|
||||
header = f'Organizational Unit: {orgunitPath}'
|
||||
if printer_id:
|
||||
header += f', printerid: {printer_id}'
|
||||
elif app_id:
|
||||
header += f', appid: {app_id}'
|
||||
print(header)
|
||||
for namespace in namespaces:
|
||||
body['policySchemaFilter'] = f'{namespace}.*'
|
||||
try:
|
||||
@@ -87,6 +94,7 @@ def printshow_policies():
|
||||
except googleapiclient.errors.HttpError:
|
||||
policies = []
|
||||
for policy in sorted(policies, key=lambda k: k.get('value', {}).get('policySchema', '')):
|
||||
print()
|
||||
name = policy.get('value', {}).get('policySchema', '')
|
||||
print(name)
|
||||
values = policy.get('value', {}).get('value', {})
|
||||
@@ -94,7 +102,6 @@ def printshow_policies():
|
||||
if isinstance(value, str) and value.find('_ENUM_') != -1:
|
||||
value = value.split('_ENUM_')[-1]
|
||||
print(f' {setting}: {value}')
|
||||
print()
|
||||
|
||||
|
||||
def build_schemas(svc=None, sfilter=None):
|
||||
|
||||
@@ -402,7 +402,9 @@ def getOrgUnitId(orgUnit, cd=None):
|
||||
return (orgUnit, result['orgUnitId'])
|
||||
|
||||
|
||||
def orgunit_from_orgunitid(orgunitid, cd):
|
||||
def orgunit_from_orgunitid(orgunitid, cd=None):
|
||||
if cd is None:
|
||||
cd = gapi_directory.build()
|
||||
orgunitpath = GM_Globals[GM_MAP_ORGUNIT_ID_TO_NAME].get(orgunitid)
|
||||
if not orgunitpath:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user