mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-04 04:41:35 +00:00
Added option convertcrnl to gam update chromepolicy
This commit is contained in:
@@ -156,7 +156,7 @@ gam create chromepolicyimage <ChromePolicyImageSchemaName> <FileName>
|
|||||||
## Update Chrome policy
|
## Update Chrome policy
|
||||||
You can update a policy for all devices/users within an OU or for a specific printer or application within an OU.
|
You can update a policy for all devices/users within an OU or for a specific printer or application within an OU.
|
||||||
```
|
```
|
||||||
gam update chromepolicy (<SchemaName> (<Field> <Value>)+)+
|
gam update chromepolicy [convertcrnl]
|
||||||
(<SchemaName> ((<Field> <Value>)+ | <JSONData>))+
|
(<SchemaName> ((<Field> <Value>)+ | <JSONData>))+
|
||||||
ou|org|orgunit <OrgUnitItem> [(printerid <PrinterID>)|(appid <AppID>)]
|
ou|org|orgunit <OrgUnitItem> [(printerid <PrinterID>)|(appid <AppID>)]
|
||||||
```
|
```
|
||||||
@@ -190,6 +190,14 @@ When specifying a value for this field you can enter the value in one of two way
|
|||||||
* `DEFAULT_PRINT_COLOR_ENUM_MONOCHROME` - The full value
|
* `DEFAULT_PRINT_COLOR_ENUM_MONOCHROME` - The full value
|
||||||
* `MONOCHROME` - The text following `..._ENUM_`
|
* `MONOCHROME` - The text following `..._ENUM_`
|
||||||
|
|
||||||
|
### TYPE_STRING fields with carriage returns (\r) and line feeds (\n)
|
||||||
|
Use the `convertcrnl` option to properly handle these characters
|
||||||
|
in value strings entered on the command line in the `<Field> <Value>` form.
|
||||||
|
```
|
||||||
|
gam update chromepolicy convertcrnl chrome.devices.DisabledDeviceReturnInstructions
|
||||||
|
deviceDisabledMessage "Please return device to:\nSchool\n123 Main Street\nAnytown US" ou /Path/to/OU
|
||||||
|
```
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
Restrict student users from adding additional printers and set default printing to black and white.
|
Restrict student users from adding additional printers and set default printing to black and white.
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -10,10 +10,19 @@ Add the `-s` option to the end of the above commands to suppress creating the `g
|
|||||||
|
|
||||||
See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation
|
See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation
|
||||||
|
|
||||||
|
### 6.66.16
|
||||||
|
|
||||||
|
Added option `convertcrnl` to `gam update chromepolicy` to properly handle carriage returns (\r) and line feeds (\n)
|
||||||
|
in value strings entered on the command line in the `<Field> <Value>` form.
|
||||||
|
```
|
||||||
|
gam update chromepolicy convertcrnl chrome.devices.DisabledDeviceReturnInstructions
|
||||||
|
deviceDisabledMessage "Please return device to:\nSchool\n123 Main Street\nAnytown US" ou /Path/to/OU
|
||||||
|
```
|
||||||
|
|
||||||
### 6.66.15
|
### 6.66.15
|
||||||
|
|
||||||
Added option `copysubfilesownedby any|me|others` to `gam <UserTypeEntity> copy drivefile` that allows
|
Added option `copysubfilesownedby any|me|others` to `gam <UserTypeEntity> copy drivefile` that allows
|
||||||
specification of which source folder sub files to copy based on file ownership; the default is `all`.
|
specification of which source folder sub files to copy based on file ownership; the default is `any`.
|
||||||
This only applies when files are being copied from a 'My Drive'.
|
This only applies when files are being copied from a 'My Drive'.
|
||||||
|
|
||||||
### 6.66.14
|
### 6.66.14
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ writes the credentials into the file oauth2.txt.
|
|||||||
admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt
|
admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt
|
||||||
admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version
|
admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version
|
||||||
WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
|
WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
|
||||||
GAMADV-XTD3 6.66.15 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 6.66.16 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.10.8 64-bit final
|
Python 3.10.8 64-bit final
|
||||||
MacOS High Sierra 10.13.6 x86_64
|
MacOS High Sierra 10.13.6 x86_64
|
||||||
@@ -1002,7 +1002,7 @@ writes the credentials into the file oauth2.txt.
|
|||||||
C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt
|
C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt
|
||||||
C:\GAMADV-XTD3>gam version
|
C:\GAMADV-XTD3>gam version
|
||||||
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
|
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
|
||||||
GAMADV-XTD3 6.66.15 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 6.66.16 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.0 64-bit final
|
Python 3.12.0 64-bit final
|
||||||
Windows-10-10.0.17134 AMD64
|
Windows-10-10.0.17134 AMD64
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ You can specify `<RegularExpression>` patterns that limit the items copied based
|
|||||||
* `shortcutnamematchpattern <RegularExpression>` - Only shortcuts whose name matches `<RegularExpression>` are copied
|
* `shortcutnamematchpattern <RegularExpression>` - Only shortcuts whose name matches `<RegularExpression>` are copied
|
||||||
|
|
||||||
### By default, when copying sub files, all files, regardless of ownership, are copied.
|
### By default, when copying sub files, all files, regardless of ownership, are copied.
|
||||||
* `copysubfilesownedby all` - All files, regardless of ownership, are copied.
|
* `copysubfilesownedby any` - All files, regardless of ownership, are copied.
|
||||||
* `copysubfilesownedby me` - Only files owned by `<UserTypeEntity>` are copied.
|
* `copysubfilesownedby me` - Only files owned by `<UserTypeEntity>` are copied.
|
||||||
* `copysubfilesownedby others` - Only files not owned by `<UserTypeEntity>` are copied.
|
* `copysubfilesownedby others` - Only files not owned by `<UserTypeEntity>` are copied.
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
Print the current version of Gam with details
|
Print the current version of Gam with details
|
||||||
```
|
```
|
||||||
gam version
|
gam version
|
||||||
GAMADV-XTD3 6.66.15 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 6.66.16 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.0 64-bit final
|
Python 3.12.0 64-bit final
|
||||||
MacOS Monterey 12.7 x86_64
|
MacOS Monterey 12.7 x86_64
|
||||||
@@ -16,7 +16,7 @@ Time: 2023-06-02T21:10:00-07:00
|
|||||||
Print the current version of Gam with details and time offset information
|
Print the current version of Gam with details and time offset information
|
||||||
```
|
```
|
||||||
gam version timeoffset
|
gam version timeoffset
|
||||||
GAMADV-XTD3 6.66.15 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 6.66.16 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.0 64-bit final
|
Python 3.12.0 64-bit final
|
||||||
MacOS Monterey 12.7 x86_64
|
MacOS Monterey 12.7 x86_64
|
||||||
@@ -28,7 +28,7 @@ Your system time differs from www.googleapis.com by less than 1 second
|
|||||||
Print the current version of Gam with extended details and SSL information
|
Print the current version of Gam with extended details and SSL information
|
||||||
```
|
```
|
||||||
gam version extended
|
gam version extended
|
||||||
GAMADV-XTD3 6.66.15 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 6.66.16 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.0 64-bit final
|
Python 3.12.0 64-bit final
|
||||||
MacOS Monterey 12.7 x86_64
|
MacOS Monterey 12.7 x86_64
|
||||||
@@ -65,7 +65,7 @@ MacOS High Sierra 10.13.6 x86_64
|
|||||||
Path: /Users/Admin/bin/gamadv-xtd3
|
Path: /Users/Admin/bin/gamadv-xtd3
|
||||||
Version Check:
|
Version Check:
|
||||||
Current: 5.35.08
|
Current: 5.35.08
|
||||||
Latest: 6.66.15
|
Latest: 6.66.16
|
||||||
echo $?
|
echo $?
|
||||||
1
|
1
|
||||||
```
|
```
|
||||||
@@ -73,7 +73,7 @@ echo $?
|
|||||||
Print the current version number without details
|
Print the current version number without details
|
||||||
```
|
```
|
||||||
gam version simple
|
gam version simple
|
||||||
6.66.15
|
6.66.16
|
||||||
```
|
```
|
||||||
In Linux/MacOS you can do:
|
In Linux/MacOS you can do:
|
||||||
```
|
```
|
||||||
@@ -83,7 +83,7 @@ echo $VER
|
|||||||
Print the current version of Gam and address of this Wiki
|
Print the current version of Gam and address of this Wiki
|
||||||
```
|
```
|
||||||
gam help
|
gam help
|
||||||
GAM 6.66.15 - https://github.com/taers232c/GAMADV-XTD3
|
GAM 6.66.16 - https://github.com/taers232c/GAMADV-XTD3
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.0 64-bit final
|
Python 3.12.0 64-bit final
|
||||||
MacOS Monterey 12.7 x86_64
|
MacOS Monterey 12.7 x86_64
|
||||||
|
|||||||
@@ -2475,7 +2475,7 @@ gam print crostelemetry [todrive <ToDriveAttribute>*]
|
|||||||
|
|
||||||
gam create chromepolicyimage <ChromePolicyImageSchemaName> <FileName>
|
gam create chromepolicyimage <ChromePolicyImageSchemaName> <FileName>
|
||||||
|
|
||||||
gam update chromepolicy
|
gam update chromepolicy [convertcrnl]
|
||||||
(<SchemaName> ((<Field> <Value>)+ | <JSONData>))+
|
(<SchemaName> ((<Field> <Value>)+ | <JSONData>))+
|
||||||
ou|org|orgunit <OrgUnitItem> [(printerid <PrinterID>)|(appid <AppID>)]
|
ou|org|orgunit <OrgUnitItem> [(printerid <PrinterID>)|(appid <AppID>)]
|
||||||
gam delete chromepolicy
|
gam delete chromepolicy
|
||||||
|
|||||||
@@ -2,10 +2,19 @@
|
|||||||
|
|
||||||
Merged GAM-Team version
|
Merged GAM-Team version
|
||||||
|
|
||||||
|
6.66.16
|
||||||
|
|
||||||
|
Added option `convertcrnl` to `gam update chromepolicy` to properly handle carriage returns (\r) and line feeds (\n)
|
||||||
|
in value strings entered on the command line in the `<Field> <Value>` form.
|
||||||
|
```
|
||||||
|
gam update chromepolicy convertcrnl chrome.devices.DisabledDeviceReturnInstructions
|
||||||
|
deviceDisabledMessage "Please return device to:\nSchool\n123 Main Street\nAnytown US" ou /Path/to/OU
|
||||||
|
```
|
||||||
|
|
||||||
6.66.15
|
6.66.15
|
||||||
|
|
||||||
Added option `copysubfilesownedby any|me|others` to `gam <UserTypeEntity> copy drivefile` that allows
|
Added option `copysubfilesownedby any|me|others` to `gam <UserTypeEntity> copy drivefile` that allows
|
||||||
specification of which source folder sub files to copy based on file ownership; the default is `all`.
|
specification of which source folder sub files to copy based on file ownership; the default is `any`.
|
||||||
This only applies when files are being copied from a 'My Drive'.
|
This only applies when files are being copied from a 'My Drive'.
|
||||||
|
|
||||||
6.66.14
|
6.66.14
|
||||||
|
|||||||
@@ -26151,7 +26151,7 @@ CHROME_SCHEMA_TYPE_MESSAGE = {
|
|||||||
CHROME_TARGET_VERSION_CHANNEL_MINUS_PATTERN = re.compile(r'^([a-z]+)-(\d+)$')
|
CHROME_TARGET_VERSION_CHANNEL_MINUS_PATTERN = re.compile(r'^([a-z]+)-(\d+)$')
|
||||||
CHROME_TARGET_VERSION_PATTERN = re.compile(r'^(\d{1,4}\.){1,4}$')
|
CHROME_TARGET_VERSION_PATTERN = re.compile(r'^(\d{1,4}\.){1,4}$')
|
||||||
|
|
||||||
# gam update chromepolicy
|
# gam update chromepolicy [convertcrnl]
|
||||||
# (<SchemaName> ((<Field> <Value>)+ | <JSONData>))+
|
# (<SchemaName> ((<Field> <Value>)+ | <JSONData>))+
|
||||||
# ou|orgunit <OrgUnitItem> [(printerid <PrinterID>)|(appid <AppID>)]
|
# ou|orgunit <OrgUnitItem> [(printerid <PrinterID>)|(appid <AppID>)]
|
||||||
def doUpdateChromePolicy():
|
def doUpdateChromePolicy():
|
||||||
@@ -26172,6 +26172,7 @@ def doUpdateChromePolicy():
|
|||||||
app_id = channelMap = orgUnit = printer_id = None
|
app_id = channelMap = orgUnit = printer_id = None
|
||||||
body = {'requests': []}
|
body = {'requests': []}
|
||||||
schemaNameList = []
|
schemaNameList = []
|
||||||
|
convertCRsNLs = False
|
||||||
while Cmd.ArgumentsRemaining():
|
while Cmd.ArgumentsRemaining():
|
||||||
myarg = getArgument()
|
myarg = getArgument()
|
||||||
if myarg in {'ou', 'org', 'orgunit'}:
|
if myarg in {'ou', 'org', 'orgunit'}:
|
||||||
@@ -26180,6 +26181,8 @@ def doUpdateChromePolicy():
|
|||||||
printer_id = getString(Cmd.OB_PRINTER_ID)
|
printer_id = getString(Cmd.OB_PRINTER_ID)
|
||||||
elif myarg == 'appid':
|
elif myarg == 'appid':
|
||||||
app_id = getString(Cmd.OB_APP_ID)
|
app_id = getString(Cmd.OB_APP_ID)
|
||||||
|
elif myarg == 'convertcrnl':
|
||||||
|
convertCRsNLs = True
|
||||||
else:
|
else:
|
||||||
schemaName, schema = simplifyChromeSchema(_getChromePolicySchema(cp, Cmd.Previous(), '*'))
|
schemaName, schema = simplifyChromeSchema(_getChromePolicySchema(cp, Cmd.Previous(), '*'))
|
||||||
body['requests'].append({'policyValue': {'policySchema': schemaName, 'value': {}},
|
body['requests'].append({'policyValue': {'policySchema': schemaName, 'value': {}},
|
||||||
@@ -26218,11 +26221,11 @@ def doUpdateChromePolicy():
|
|||||||
value = field['value']
|
value = field['value']
|
||||||
if vtype in ['TYPE_INT64', 'TYPE_INT32', 'TYPE_UINT64']:
|
if vtype in ['TYPE_INT64', 'TYPE_INT32', 'TYPE_UINT64']:
|
||||||
value = int(value)
|
value = int(value)
|
||||||
elif vtype in ['TYPE_BOOL']:
|
elif vtype == 'TYPE_BOOL':
|
||||||
pass
|
pass
|
||||||
elif vtype in ['TYPE_ENUM']:
|
elif vtype == 'TYPE_ENUM':
|
||||||
value = f"{schema['settings'][lowerField]['enum_prefix']}{value}"
|
value = f"{schema['settings'][lowerField]['enum_prefix']}{value}"
|
||||||
elif vtype in ['TYPE_LIST']:
|
elif vtype == 'TYPE_LIST':
|
||||||
value = value.split(',') if value else []
|
value = value.split(',') if value else []
|
||||||
if myarg == 'chrome.users.chromebrowserupdates' and casedField == 'targetVersionPrefixSetting':
|
if myarg == 'chrome.users.chromebrowserupdates' and casedField == 'targetVersionPrefixSetting':
|
||||||
mg = CHROME_TARGET_VERSION_CHANNEL_MINUS_PATTERN.match(value)
|
mg = CHROME_TARGET_VERSION_CHANNEL_MINUS_PATTERN.match(value)
|
||||||
@@ -26272,7 +26275,7 @@ def doUpdateChromePolicy():
|
|||||||
Cmd.Backup()
|
Cmd.Backup()
|
||||||
invalidArgumentExit(integerLimits(None, None))
|
invalidArgumentExit(integerLimits(None, None))
|
||||||
value = int(value)
|
value = int(value)
|
||||||
elif vtype in ['TYPE_BOOL']:
|
elif vtype == 'TYPE_BOOL':
|
||||||
value = value.lower()
|
value = value.lower()
|
||||||
if value in TRUE_VALUES:
|
if value in TRUE_VALUES:
|
||||||
value = True
|
value = True
|
||||||
@@ -26280,7 +26283,7 @@ def doUpdateChromePolicy():
|
|||||||
value = False
|
value = False
|
||||||
else:
|
else:
|
||||||
invalidChoiceExit(value, TRUE_FALSE, True)
|
invalidChoiceExit(value, TRUE_FALSE, True)
|
||||||
elif vtype in ['TYPE_ENUM']:
|
elif vtype == 'TYPE_ENUM':
|
||||||
value = value.upper()
|
value = value.upper()
|
||||||
prefix = schema['settings'][field]['enum_prefix']
|
prefix = schema['settings'][field]['enum_prefix']
|
||||||
enum_values = schema['settings'][field]['enums']
|
enum_values = schema['settings'][field]['enums']
|
||||||
@@ -26290,8 +26293,10 @@ def doUpdateChromePolicy():
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
invalidChoiceExit(value, enum_values, True)
|
invalidChoiceExit(value, enum_values, True)
|
||||||
elif vtype in ['TYPE_LIST']:
|
elif vtype == 'TYPE_LIST':
|
||||||
value = value.split(',') if value else []
|
value = value.split(',') if value else []
|
||||||
|
elif vtype == 'TYPE_STRING' and convertCRsNLs:
|
||||||
|
value = unescapeCRsNLs(value)
|
||||||
if myarg == 'chrome.users.chromebrowserupdates' and casedField == 'targetVersionPrefixSetting':
|
if myarg == 'chrome.users.chromebrowserupdates' and casedField == 'targetVersionPrefixSetting':
|
||||||
mg = CHROME_TARGET_VERSION_CHANNEL_MINUS_PATTERN.match(value)
|
mg = CHROME_TARGET_VERSION_CHANNEL_MINUS_PATTERN.match(value)
|
||||||
if mg:
|
if mg:
|
||||||
|
|||||||
Reference in New Issue
Block a user