Added option contentrestrictions ownerrestricted [<Boolean>] to <DriveFileAttribute>.

This commit is contained in:
Ross Scroggs
2023-07-27 10:00:54 -07:00
parent e26cda1d6b
commit 01aaff9b83
3 changed files with 16 additions and 17 deletions

View File

@ -5833,9 +5833,7 @@ gam <UserTypeEntity> show datastudiopermissions
<FileSelector> | <CSVFileSelector> | <CSVkmdSelector> | <CSVSubkeySelector> | <CSVDataSelector>)
<DriveFileAttribute> ::=
(contentrestrictions ownerrestricted [<Boolean>])|
(contentrestrictions readonly false)|
(contentrestrictions readonly true [reason <String>])|
(contentrestrictions (readonly false)|(readonly true [reason <String>]) [ownerrestricted [<Boolean>]])|
(copyrequireswriterpermission [<Boolean>])|
(description <String>)|
(folderColorRgb <ColorValue>)|
@ -5906,9 +5904,7 @@ gam <UserTypeEntity> update drivefile <DriveFileEntity> [copy] [returnidonly|ret
[charset <CharSet>] [columndelimiter <Character>]
<DriveFileCopyAttribute> ::=
(contentrestrictions ownerrestricted [<Boolean>])|
(contentrestrictions readonly false)|
(contentrestrictions readonly true [reason <String>])|
(contentrestrictions (readonly false)|(readonly true [reason <String>]) [ownerrestricted [<Boolean>]])|
(copyrequireswriterpermission [<Boolean>])|
(description <String>)|
ignoredefaultvisibility|

View File

@ -11,7 +11,7 @@ Added option `contentrestrictions ownerrestricted [<Boolean>]` to `<DriveFileAtt
Added `aggregatebyuser [Boolean]` option to `gam report user` to allow data aggregation for users across multiple dates.
Options `aggregatebyuser` and `aggregatebydate` are mutually exclusive.
* https://github.com/taers232c/GAMADV-XTD3/wiki/Reports#user-reports
* See: https://github.com/taers232c/GAMADV-XTD3/wiki/Reports#user-reports
6.61.13

View File

@ -48669,13 +48669,14 @@ DRIVEFILE_PROPERTY_VISIBILITY_CHOICE_MAP = {
DRIVE_FILE_CONTENT_RESTRICTIONS_CHOICE_MAP = {
'readonly': 'readOnly',
'ownerrestricted': 'ownerRestricted',
}
def getDriveFileProperty(visibility=None):
key = getString(Cmd.OB_PROPERTY_KEY)
value = getString(Cmd.OB_PROPERTY_VALUE, minLen=0) or None
if visibility is None:
if Cmd.PeekArgumentPresent(DRIVEFILE_PROPERTY_VISIBILITY_CHOICE_MAP):
if Cmd.PeekArgumentPresent(list(DRIVEFILE_PROPERTY_VISIBILITY_CHOICE_MAP.keys())):
visibility = getChoice(DRIVEFILE_PROPERTY_VISIBILITY_CHOICE_MAP, mapChoice=True)
else:
visibility = 'properties'
@ -48746,16 +48747,17 @@ def getDriveFileCopyAttribute(myarg, body, parameters):
elif myarg == 'writerscantshare':
body['writersCanShare'] = not getBoolean()
elif myarg == 'contentrestrictions':
body['contentRestrictions'] = [{}]
restriction = getChoice(DRIVE_FILE_CONTENT_RESTRICTIONS_CHOICE_MAP, mapChoice=True)
if restriction == 'readOnly':
while Cmd.PeekArgumentPresent(list(DRIVE_FILE_CONTENT_RESTRICTIONS_CHOICE_MAP.keys())):
body.setdefault('contentRestrictions', [{}])
restriction = getChoice(DRIVE_FILE_CONTENT_RESTRICTIONS_CHOICE_MAP, mapChoice=True)
body['contentRestrictions'][0][restriction] = getBoolean()
if checkArgumentPresent(['reason']):
if body['contentRestrictions'][0][restriction]:
body['contentRestrictions'][0]['reason'] = getString(Cmd.OB_STRING, minLen=0)
else:
Cmd.Backup()
usageErrorExit(Msg.REASON_ONLY_VALID_WITH_CONTENTRESTRICTIONS_READONLY_TRUE)
if restriction == 'readOnly':
if checkArgumentPresent(['reason']):
if body['contentRestrictions'][0][restriction]:
body['contentRestrictions'][0]['reason'] = getString(Cmd.OB_STRING, minLen=0)
else:
Cmd.Backup()
usageErrorExit(Msg.REASON_ONLY_VALID_WITH_CONTENTRESTRICTIONS_READONLY_TRUE)
elif myarg == 'property':
driveprop = getDriveFileProperty()
body.setdefault(driveprop['visibility'], {})
@ -49647,6 +49649,7 @@ DRIVE_CAPABILITIES_SUBFIELDS_CHOICE_MAP = {
}
DRIVE_CONTENT_RESTRICTIONS_SUBFIELDS_CHOICE_MAP = {
'ownerrestricted': 'ownerRestricted',
'readonly': 'readOnly',
'reason': 'reason',
'restrictinguser': 'restructingUser',