mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-04 21:01:36 +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',
|
# 'chrome.devices.kiosk',
|
||||||
]
|
]
|
||||||
throw_reasons = [gapi_errors.ErrorReason.FOUR_O_O,]
|
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:
|
for namespace in namespaces:
|
||||||
body['policySchemaFilter'] = f'{namespace}.*'
|
body['policySchemaFilter'] = f'{namespace}.*'
|
||||||
try:
|
try:
|
||||||
@@ -87,6 +94,7 @@ def printshow_policies():
|
|||||||
except googleapiclient.errors.HttpError:
|
except googleapiclient.errors.HttpError:
|
||||||
policies = []
|
policies = []
|
||||||
for policy in sorted(policies, key=lambda k: k.get('value', {}).get('policySchema', '')):
|
for policy in sorted(policies, key=lambda k: k.get('value', {}).get('policySchema', '')):
|
||||||
|
print()
|
||||||
name = policy.get('value', {}).get('policySchema', '')
|
name = policy.get('value', {}).get('policySchema', '')
|
||||||
print(name)
|
print(name)
|
||||||
values = policy.get('value', {}).get('value', {})
|
values = policy.get('value', {}).get('value', {})
|
||||||
@@ -94,7 +102,6 @@ def printshow_policies():
|
|||||||
if isinstance(value, str) and value.find('_ENUM_') != -1:
|
if isinstance(value, str) and value.find('_ENUM_') != -1:
|
||||||
value = value.split('_ENUM_')[-1]
|
value = value.split('_ENUM_')[-1]
|
||||||
print(f' {setting}: {value}')
|
print(f' {setting}: {value}')
|
||||||
print()
|
|
||||||
|
|
||||||
|
|
||||||
def build_schemas(svc=None, sfilter=None):
|
def build_schemas(svc=None, sfilter=None):
|
||||||
|
|||||||
@@ -402,7 +402,9 @@ def getOrgUnitId(orgUnit, cd=None):
|
|||||||
return (orgUnit, result['orgUnitId'])
|
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)
|
orgunitpath = GM_Globals[GM_MAP_ORGUNIT_ID_TO_NAME].get(orgunitid)
|
||||||
if not orgunitpath:
|
if not orgunitpath:
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user