mirror of
https://github.com/GAM-team/GAM.git
synced 2025-07-10 06:33:34 +00:00
Support Drive content restrictions
This commit is contained in:
@ -3454,6 +3454,7 @@ def initializeDriveFileAttributes():
|
|||||||
|
|
||||||
|
|
||||||
def getDriveFileAttribute(i, body, parameters, myarg, update=False):
|
def getDriveFileAttribute(i, body, parameters, myarg, update=False):
|
||||||
|
operation = 'update' if update else 'add'
|
||||||
if myarg == 'localfile':
|
if myarg == 'localfile':
|
||||||
parameters[DFA_LOCALFILEPATH] = sys.argv[i + 1]
|
parameters[DFA_LOCALFILEPATH] = sys.argv[i + 1]
|
||||||
parameters[DFA_LOCALFILENAME] = os.path.basename(
|
parameters[DFA_LOCALFILENAME] = os.path.basename(
|
||||||
@ -3529,9 +3530,22 @@ def getDriveFileAttribute(i, body, parameters, myarg, update=False):
|
|||||||
elif myarg == 'writerscantshare':
|
elif myarg == 'writerscantshare':
|
||||||
body['writersCanShare'] = False
|
body['writersCanShare'] = False
|
||||||
i += 1
|
i += 1
|
||||||
|
elif myarg == 'contentrestrictions':
|
||||||
|
body['contentRestrictions'] = [{}]
|
||||||
|
restriction = sys.argv[i+1].lower().replace('_', '')
|
||||||
|
if restriction == 'readonly':
|
||||||
|
body['contentRestrictions'][0]['readOnly'] = getBoolean(
|
||||||
|
sys.argv[i+2], f'gam <users> {operation} drivefile')
|
||||||
|
i += 3
|
||||||
|
if len(sys.argv) > i and sys.argv[i].lower() == 'reason':
|
||||||
|
body['contentRestrictions'][0]['reason'] = sys.argv[i+1]
|
||||||
|
i += 2
|
||||||
|
else:
|
||||||
|
controlflow.invalid_argument_exit(
|
||||||
|
restriction, f'gam <users> {operation} drivefile')
|
||||||
else:
|
else:
|
||||||
controlflow.invalid_argument_exit(
|
controlflow.invalid_argument_exit(
|
||||||
myarg, f"gam <users> {['add', 'update'][update]} drivefile")
|
myarg, f"gam <users> {operation} drivefile")
|
||||||
return i
|
return i
|
||||||
|
|
||||||
|
|
||||||
|
@ -223,7 +223,6 @@ V1_DISCOVERY_APIS = {
|
|||||||
'appsactivity',
|
'appsactivity',
|
||||||
'calendar',
|
'calendar',
|
||||||
'drive',
|
'drive',
|
||||||
'licensing',
|
|
||||||
'oauth2',
|
'oauth2',
|
||||||
'reseller',
|
'reseller',
|
||||||
'siteVerification',
|
'siteVerification',
|
||||||
|
Reference in New Issue
Block a user