From 9585f6c598928face4cd95e5da4066afd13b5a40 Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Fri, 9 Oct 2020 08:28:27 -0700 Subject: [PATCH] reason not valid woth readonly false; add contentrestrions to file field list (#1263) --- src/gam/__init__.py | 6 +++++- src/gam/var.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 7be99de6..ce0ffb7b 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -3538,7 +3538,11 @@ def getDriveFileAttribute(i, body, parameters, myarg, update=False): sys.argv[i+2], f'gam {operation} drivefile') i += 3 if len(sys.argv) > i and sys.argv[i].lower() == 'reason': - body['contentRestrictions'][0]['reason'] = sys.argv[i+1] + if body['contentRestrictions'][0]['readOnly']: + body['contentRestrictions'][0]['reason'] = sys.argv[i+1] + else: + controlflow.invalid_argument_exit( + 'reason', 'contentrestrictions readonly false') i += 2 else: controlflow.invalid_argument_exit( diff --git a/src/gam/var.py b/src/gam/var.py index f91affc9..6624c267 100644 --- a/src/gam/var.py +++ b/src/gam/var.py @@ -380,6 +380,7 @@ DRIVEFILE_FIELDS_CHOICES_MAP = { 'appdatacontents': 'appDataContents', 'cancomment': 'canComment', 'canreadrevisions': 'canReadRevisions', + 'contentrestrictions': 'contentRestrictions', 'copyable': 'copyable', 'copyrequireswriterpermission': 'copyRequiresWriterPermission', 'createddate': 'createdDate',