Multiple updates/fixes

This commit is contained in:
Ross Scroggs
2023-11-25 09:18:06 -08:00
parent 0562639715
commit 46d4e78b79
9 changed files with 248 additions and 32 deletions

View File

@@ -10,6 +10,24 @@ 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
### 6.65.17
Added the option `mappermissionsdomain <DomainName1> <DomainName2>` to `gam <UserTypeEntity> create drivefileacl <DriveFileEntity>`
that maps `<DomainName1>` to `<DomainName2>` in the `user <UserItem>)|(group <GroupItem>)|(domain <DomainName>)` options;
`<UserItem>` and `<GroupItem>` must specify email addresses for the mapping to succeed.
The option can be specified multiple times to provide different mappings. This option will be most useful
when reading a CSV file containing ACLs referencing `<DomainName1>` and you want a new ACL with the same options but in `<DomainName2>`.
### 6.65.16
Fixed bug in `gam <UserTypeEntity> print filecounts` where `Item Cap` showed an incorrect value.
Added option `addorigfieldstosubject` to `gam <UserTypeEntity> forward messages|threads` that causes GAM
to append the original `from`, `to` and `date` fields to the message subject.
```
Fwd: Ross to TestUser (Original From: Ross Scroggs <ross.scroggs@gmail.com> To: testuser@domain.com Date: Thu, 23 Nov 2023 07:01:59 -0800)
```
### 6.65.15
Added additional options to `gam <UserTypeEntity> print|show youtubechannels`.

View File

@@ -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$ ./gam version
WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
GAMADV-XTD3 6.65.15 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.65.17 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.10.8 64-bit final
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>gam version
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
GAMADV-XTD3 6.65.15 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.65.17 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
Windows-10-10.0.17134 AMD64

View File

@@ -17,6 +17,12 @@
- [Empty calendar trash](#empty-calendar-trash)
- [Display calendar events](#display-calendar-events)
- [Update calendar event attendees](#update-calendar-event-attendees)
- [Focus time events](#focus-time-events)
- [Manage focus time events](#manage-focus-time-events)
- [Display focus time events](#display-focus-time-events)
- [Out of officeevents](#out-of-office-events)
- [Manage Out of office events](#manage-out-of-office-events)
- [Display Out of officeevents](#display-out-of-office-events)
- [Working location events](#working-location-events)
- [Manage working location events](#manage-working-location-events)
- [Display working location events](#display-working-location-events)
@@ -166,12 +172,21 @@
creator.id|
creator.self
<EventFocusTimePropertiesSubfieldName> ::=
focustimeproperties.chatstatus|
focustimeproperties.declinemode|
focustimeproperties.declinemessage
<EventOrganizerSubfieldName> ::=
organizer.displayname|
organizer.email|
organizer.id|
organizer.self
<EventOutOfOfficePropertiesSubfieldName> ::=
outofoffice.declinemode|
outofoffice.declinemessage
<EventWorkingLocationPropertiesSubfieldName> ::=
workinglocationproperties.homeoffice|
workinglocationproperties.customlocation|
@@ -195,6 +210,7 @@
endtimeunspecified|
extendedproperties|
eventtype|
<EventFocusTimePropertiesSubfieldName>
gadget|
guestscaninviteothers|
guestscanmodify|
@@ -208,6 +224,7 @@
organizer|
<EventOrganizerSubfieldName>|
originalstart|originalstarttime|
<EventOutOfOfficePropertiesSubfieldName>
privatecopy|
recurrence|
recurringeventid|
@@ -228,9 +245,17 @@
<AttendeeStatus> ::= accepted|declined|needsaction|tentative
```
```
<EventType> ::=
default|
focustime|
outofoffice|
workinglocation
<EventTypeList> ::= "<EventType>(,<EventType>)*"
<EventSelectProperty> ::=
(after|starttime|timemin <Time>)|
(before|endtime|timemax <Time>)|
(eventtypes <EventTypeList>)|
(query <QueryCalendar>)|
(privateextendedproperty <String>)|
(sharedextendedproperty <String>)|
@@ -285,6 +310,7 @@
(colorindex|colorid <EventColorIndex>)|
(description <String>)|
(end (allday <Date>)|<Time>)|
(focustime [declinemode none|all|new] [declinemessage <String>] [chatstatus available|donotdisturb])|
(guestscaninviteothers <Boolean>)|
guestscantinviteothers|
(guestscanmodify <Boolean>)|
@@ -298,6 +324,7 @@
(noreminders|(reminder email|popup <Number>))|
(optionalattendee <EmailAddress>)|
(originalstart|originalstarttime (allday <Date>)|<Time>)|
(outofoffice [declinemode none|all|new] [declinemessage <String>])|
(privateproperty <PropertyKey> <PropertyValue>)|
(recurrence <RRULE, EXRULE, RDATE and EXDATE line>)|
(reminder <Number> email|popup))|
@@ -362,10 +389,12 @@ This is dense reading; a simpler approach is to define a test event in Google Ca
the recurrence rule that you want, then use `gam calendar <EmailAddress> info events eventid <EventId>` to get the recurrence rule and use it in subsequent commands.
```
RRULE:FREQ=DAILY
RRULE:FREQ=DAILY;COUNT=30
RRULE:FREQ=WEEKLY;BYDAY=WE
RRULE:FREQ=WEEKLY;WKST=SU;COUNT=13;BYDAY=WE
RRULE:FREQ=DAILY - Daily
RRULE:FREQ=DAILY;COUNT=30 - Daily for 30 days
RRULE:FREQ=WEEKLY - Weekly on the same day of the week as the starting day; e.g., every Wednesday
RRULE:FREQ=WEEKLY;COUNT=13 - Weekly on the same day of the week as the starting day; e.g., every Wednesday, for 13 weeks
RRULE:FREQ=MONTHLY - Monthly on the same day of the month as the starting day; e.g., every 15th of the month
RRULE:FREQ=MONTHLY;BYDAY=4TH - Monthly on the fourth instance of the starting day; e.g., every 4th Thursday
```
## Event colors
@@ -692,6 +721,103 @@ the second adds the primary email.
The attendee changes are displayed but not processed unless `doit` is specified.
## Focus time events
## Manage focus time events
You can create and delete focus time events; they can not be updated.
To update a working location event, delete the working location event and recreate it.
```
gam <UserTypeEntity> create focustime
[chatstatus available|donotdisturb]|
[declinemode none|all|new] [declinemessage <String>]|
(timerange <Time> <Time>)+
gam <UserTypeEntity> delete focustime
(timerange <Time> <Time>)+
```
focus time events span a time range:
* `timerange <Time> <Time>` - A time range, may span multiple days
## Display focus time events
```
gam <UserTypeEntity> show focustime
(timerange <Time> <Time>)+
[showdayofweek]
[formatjson]
```
`showdayofweek` displays `dayOfWeek` when event start and end times are displayed.
By default, Gam displays the information as an indented list of keys and values.
* `formatjson` - Display the fields in JSON format.
```
gam <UserTypeEntity> print focustime
(timerange <Time> <Time>)+
[showdayofweek]
[formatjson [quotechar <Character>]] [todrive <ToDriveAttribute>*]
```
`showdayofweek` displays columns `start.dayOfWeek` and `end.dayOfWeek` when event start and end times are displayed.
By default, Gam displays the information as columns of fields; the following option causes the output to be in JSON format,
* `formatjson` - Display the fields in JSON format.
By default, Gam displays event details, use `countsonly` to display only the number of events. `formatjson` does not apply in this case.
By default, when writing CSV files, Gam uses a quote character of double quote `"`. The quote character is used to enclose columns that contain
the quote character itself, the column delimiter (comma by default) and new-line characters. Any quote characters within the column are doubled.
When using the `formatjson` option, double quotes are used extensively in the data resulting in hard to read/process output.
The `quotechar <Character>` option allows you to choose an alternate quote character, single quote for instance, that makes for readable/processable output.
`quotechar` defaults to `gam.cfg/csv_output_quote_char`. When uploading CSV files to Google, double quote `"` should be used.
## Out of office events
## Manage out of office events
You can create and delete out of office events; they can not be updated.
To update a working location event, delete the working location event and recreate it.
```
gam <UserTypeEntity> create outofoffice
[declinemode none|all|new] [declinemessage <String>]|
(timerange <Time> <Time>)+
gam <UserTypeEntity> delete outofoffice
(timerange <Time> <Time>)+
```
out of office events span a time range:
* `timerange <Time> <Time>` - A time range, may span multiple days
## Display out of office events
```
gam <UserTypeEntity> show outofoffice
(timerange <Time> <Time>)+
[showdayofweek]
[formatjson]
```
`showdayofweek` displays `dayOfWeek` when event start and end times are displayed.
By default, Gam displays the information as an indented list of keys and values.
* `formatjson` - Display the fields in JSON format.
```
gam <UserTypeEntity> print outofoffice
(timerange <Time> <Time>)+
[showdayofweek]
[formatjson [quotechar <Character>]] [todrive <ToDriveAttribute>*]
```
`showdayofweek` displays columns `start.dayOfWeek` and `end.dayOfWeek` when event start and end times are displayed.
By default, Gam displays the information as columns of fields; the following option causes the output to be in JSON format,
* `formatjson` - Display the fields in JSON format.
By default, Gam displays event details, use `countsonly` to display only the number of events. `formatjson` does not apply in this case.
By default, when writing CSV files, Gam uses a quote character of double quote `"`. The quote character is used to enclose columns that contain
the quote character itself, the column delimiter (comma by default) and new-line characters. Any quote characters within the column are doubled.
When using the `formatjson` option, double quotes are used extensively in the data resulting in hard to read/process output.
The `quotechar <Character>` option allows you to choose an alternate quote character, single quote for instance, that makes for readable/processable output.
`quotechar` defaults to `gam.cfg/csv_output_quote_char`. When uploading CSV files to Google, double quote `"` should be used.
## Working location events
## Manage working location events

View File

@@ -129,11 +129,18 @@ specify `basicpermissions` and additional permission fields, e.g., `permissions.
gam <UserTypeEntity> create|add drivefileacl <DriveFileEntity>
anyone|(user <UserItem>)|(group <GroupItem>)|(domain <DomainName>) (role <DriveFileACLRole>)
[withlink|(allowfilediscovery|discoverable [<Boolean>])] [expiration <Time>]
(mappermissionsdomain <DomainName> <DomainName>)*
[movetonewownersroot [<Boolean>]]
[sendemail] [emailmessage <String>]
[updatesheetprotectedranges [<Boolean>]]
[showtitles] [nodetails|(csv [todrive <ToDriveAttribute>*] [formatjson [quotechar <Character>]])]
```
The option `mappermissionsdomain <DomainName1> <DomainName2>` maps `<DomainName1>` to `<DomainName2>` in the
`user <UserItem>)|(group <GroupItem>)|(domain <DomainName>)` options;
`<UserItem>` and `<GroupItem>` must specify email addresses for the mapping to succeed.
The option can be specified multiple times to provide different mappings. This option will be most useful
when reading a CSV file containing ACLs referencing `<DomainName1>` and you want a new ACL with the same options but in `<DomainName2>`.
From the Google Drive API documentation.
* `movetonewownersroot` - This parameter only takes effect if the item is not in a shared drive and the request is attempting to transfer the ownership of the item.
* `false` - Parents are not changed. The file is an orphan for the new owner. This is the default.

View File

@@ -372,17 +372,22 @@ See below for message selection.
gam <UserTypeEntity> forward message|messages recipient|to <RecipientEntity>
(((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+
[quick|notquick] [doit] [max_to_forward <Number>])|(ids <MessageIDEntity>)
[subject <String>]
[subject <String>] [addorigfieldstosubject]
gam <UserTypeEntity> forward thread|threads recipient|to <RecipientEntity>
(((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+
[quick|notquick] [doit] [max_to_forward <Number>])|(ids <ThreadIDEntity>)
[subject <String>]
[subject <String>] [addorigfieldstosubject]
```
By default, the message subject has `Fwd: ` prepended; use `subject <String>` to specify a new subject.
All `Cc` addresses are removed from the forwarded message.
If `addorigfieldstosubject` is specified, GAM appends the original `from`, `to` and `date` fields to the message subject.
```
Fwd: Ross to TestUser (Original From: Ross Scroggs <ross.scroggs@gmail.com> To: testuser@domain.com Date: Thu, 23 Nov 2023 07:01:59 -0800)
```
See below for message selection.
## Manage messages/threads

View File

@@ -4,7 +4,7 @@
Print the current version of Gam with details
```
gam version
GAMADV-XTD3 6.65.15 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.65.17 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
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
```
gam version timeoffset
GAMADV-XTD3 6.65.15 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.65.17 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
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
```
gam version extended
GAMADV-XTD3 6.65.15 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.65.17 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
MacOS Monterey 12.7 x86_64
@@ -65,7 +65,7 @@ MacOS High Sierra 10.13.6 x86_64
Path: /Users/Admin/bin/gamadv-xtd3
Version Check:
Current: 5.35.08
Latest: 6.65.15
Latest: 6.65.17
echo $?
1
```
@@ -73,7 +73,7 @@ echo $?
Print the current version number without details
```
gam version simple
6.65.15
6.65.17
```
In Linux/MacOS you can do:
```
@@ -83,7 +83,7 @@ echo $VER
Print the current version of Gam and address of this Wiki
```
gam help
GAM 6.65.15 - https://github.com/taers232c/GAMADV-XTD3
GAM 6.65.17 - https://github.com/taers232c/GAMADV-XTD3
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
MacOS Monterey 12.7 x86_64

View File

@@ -4589,6 +4589,7 @@ In these commands, the Google administrator named in oauth2.txt is used.
gam create|add drivefileacl <SharedDriveEntityAdmin>
anyone|(user <UserItem>)|(group <GroupItem>)|(domain <DomainName>)
(role <DriveFileACLRole>) [withlink|(allowfilediscovery|discoverable [<Boolean>])]
(mappermissionsdomain <DomainName> <DomainName>)*
[expiration <Time>] [sendemail] [emailmessage <String>]
[showtitles] [nodetails|(csv [todrive <ToDriveAttribute>*] [formatjson [quotechar <Character>]])]
gam update drivefileacl <SharedDriveEntityAdmin> <DriveFilePermissionIDorEmail>
@@ -4626,6 +4627,7 @@ In these commands, you specify an administrator and then indicate that you want
gam <UserTypeEntity> create|add drivefileacl <SharedDriveEntityAdmin>
anyone|(user <UserItem>)|(group <GroupItem>)|(domain <DomainName>)
(role <DriveFileACLRole>) [withlink|(allowfilediscovery|discoverable [<Boolean>])]
(mappermissionsdomain <DomainName> <DomainName>)*
[movetonewownersroot [<Boolean>]]
[expiration <Time>] [sendemail] [emailmessage <String>]
[showtitles] [nodetails|(csv [todrive <ToDriveAttribute>*] [formatjson [quotechar <Character>]])]
@@ -6934,11 +6936,11 @@ gam <UserTypeEntity> export thread|threads
gam <UserTypeEntity> forward message|messages recipient|to <RecipientEntity>
(((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+
[quick|notquick] [doit] [max_to_forward <Number>])|(ids <MessageIDEntity>)
[subject <String>] [altcharset <String>]
[subject <String>] [addorigfieldstosubject [<Boolean>]] [altcharset <String>]
gam <UserTypeEntity> forward thread|thtreads recipient|to <RecipientEntity>
(((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+
quick|notquick] [doit] [max_to_forward <Number>])|(ids <ThreadIDEntity>)
[subject <String>] [altcharset <String>]
[subject <String>] [addorigfieldstosubject [<Boolean>]] [altcharset <String>]
gam <UserTypeEntity> show messages|threads
(((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])*

View File

@@ -2,6 +2,24 @@
Merged GAM-Team version
6.65.17
Added the option `mappermissionsdomain <DomainName1> <DomainName2>` to `gam <UserTypeEntity> create drivefileacl <DriveFileEntity>`
that maps `<DomainName1>` to `<DomainName2>` in the `user <UserItem>)|(group <GroupItem>)|(domain <DomainName>)` options;
`<UserItem>` and `<GroupItem>` must specify email addresses for the mapping to succeed.
The option can be specified multiple times to provide different mappings. This option will be most useful
when reading a CSV file containing ACLs referencing `<DomainName1>` and you want a new ACL with the same options but in `<DomainName2>`.
6.65.16
Fixed bug in `gam <UserTypeEntity> print filecounts` where `Item Cap` showed an incorrect value.
Added option `addorigfieldstosubject` to `gam <UserTypeEntity> forward messages|threads` that causes GAM
to append the original `from`, `to` and `date` fields to the message subject.
```
Fwd: Ross to TestUser (Original From: Ross Scroggs <ross.scroggs@gmail.com> To: testuser@domain.com Date: Thu, 23 Nov 2023 07:01:59 -0800)
```
6.65.15
Added additional options to `gam <UserTypeEntity> print|show youtubechannels`.

View File

@@ -1082,7 +1082,7 @@ def getLabelColor(colorType):
invalidArgumentExit('|'.join(colorType))
missingArgumentExit(Cmd.OB_LABEL_COLOR_HEX)
# Language codes used in Drive Labels
# Language codes used in Drive Labels/Youtube
BCP47_LANGUAGE_CODES_MAP = {
'ar-sa': 'ar-SA', 'cs-cz': 'cs-CZ', 'da-dk': 'da-DK', 'de-de': 'de-DE', #Arabic Saudi Arabia, Czech Czech Republic, Danish Denmark, German Germany
'el-gr': 'el-GR', 'en-au': 'en-AU', 'en-gb': 'en-GB', 'en-ie': 'en-IE', #Modern Greek Greece, English Australia, English United Kingdom, English Ireland
@@ -35639,6 +35639,14 @@ def _getCalendarEventAttribute(myarg, body, parameters, function):
body['originalStart'] = getEventTime()
elif myarg in {'end', 'endtime'}:
body['end'] = getEventTime()
elif myarg == 'allday':
body['start'] = body['end'] = {'date': getYYYYMMDD()}
elif myarg == 'range':
body['start'] = {'date': getYYYYMMDD()}
body['end'] = {'date': getYYYYMMDD()}
elif myarg == 'timerange':
body['start'] = {'dateTime': getTimeOrDeltaFromNow()}
body['end'] = {'dateTime': getTimeOrDeltaFromNow()}
elif myarg == 'attachment':
body.setdefault('attachments', [])
body['attachments'].append({'title': getString(Cmd.OB_STRING), 'fileUrl': getString(Cmd.OB_URL)})
@@ -35750,8 +35758,6 @@ def _getCalendarEventAttribute(myarg, body, parameters, function):
body['extendedProperties'].setdefault('shared', {})
key = getString(Cmd.OB_PROPERTY_KEY)
body['extendedProperties']['shared'][key] = getString(Cmd.OB_PROPERTY_VALUE, minLen=0)
elif myarg == 'workinglocation':
getWorkingLocationProperties(body)
elif function == 'update' and myarg == 'clearprivateproperty':
body.setdefault('extendedProperties', {})
body['extendedProperties'].setdefault('private', {})
@@ -36504,6 +36510,7 @@ EVENT_FIELDS_CHOICE_MAP = {
'endtime': 'end',
'endtimeunspecified': 'endTimeUnspecified',
'extendedproperties': 'extendedProperties',
'focustimeproperties': 'focusTimeProperties',
'gadget': 'gadget',
'guestscaninviteothers': 'guestsCanInviteOthers',
'guestscanmodify': 'guestsCanModify',
@@ -36519,6 +36526,7 @@ EVENT_FIELDS_CHOICE_MAP = {
'organiser': 'organizer',
'originalstart': 'originalStartTime',
'originalstarttime': 'originalStartTime',
'outofofficeproperties': 'outOfOfficeProperties',
'privatecopy': 'privateCopy',
'recurrence': 'recurrence',
'recurringeventid': 'recurringEventId',
@@ -36573,6 +36581,12 @@ EVENT_CREATOR_SUBFIELDS_CHOICE_MAP = {
'self': 'self',
}
EVENT_FOCUSTIME_SUBFIELDS_CHOICE_MAP = {
'autodeclinemode': 'autoDeclineMode',
'chatstatus': 'chatStatus',
'declinemessage': 'declineMessage',
}
EVENT_ORGANIZER_SUBFIELDS_CHOICE_MAP = {
'displayname': 'displayName',
'email': 'email',
@@ -36580,6 +36594,11 @@ EVENT_ORGANIZER_SUBFIELDS_CHOICE_MAP = {
'self': 'self',
}
EVENT_OUTOFOFFICE_SUBFIELDS_CHOICE_MAP = {
'autodeclinemode': 'autoDeclineMode',
'declinemessage': 'declineMessage',
}
EVENT_WORKINGLOCATION_SUBFIELDS_CHOICE_MAP = {
'homeoffice': 'homeOffice',
'customlocation': 'customLocation',
@@ -36591,8 +36610,10 @@ EVENT_SUBFIELDS_CHOICE_MAP = {
'attendees': EVENT_ATTENDEES_SUBFIELDS_CHOICE_MAP,
'conferencedata': EVENT_CONFERENCEDATA_SUBFIELDS_CHOICE_MAP,
'creator': EVENT_CREATOR_SUBFIELDS_CHOICE_MAP,
'focustimeproperties': EVENT_FOCUSTIME_SUBFIELDS_CHOICE_MAP,
'organizer': EVENT_ORGANIZER_SUBFIELDS_CHOICE_MAP,
'organiser': EVENT_ORGANIZER_SUBFIELDS_CHOICE_MAP,
'outofofficeproperties': EVENT_OUTOFOFFICE_SUBFIELDS_CHOICE_MAP,
'workinglocationproperties': EVENT_WORKINGLOCATION_SUBFIELDS_CHOICE_MAP,
}
@@ -53013,7 +53034,7 @@ def printShowFileCounts(users):
Ind.Decrement()
else:
if sharedDriveId:
row = {'User': user, 'id': sharedDriveId, 'name': sharedDriveName, 'Total': countTotal, 'Item cap': f"{sizeTotal/SHARED_DRIVE_MAX_FILES_FOLDERS:.2%}"}
row = {'User': user, 'id': sharedDriveId, 'name': sharedDriveName, 'Total': countTotal, 'Item cap': f"{countTotal/SHARED_DRIVE_MAX_FILES_FOLDERS:.2%}"}
else:
row = {'User': user, 'Total': countTotal}
if showSize:
@@ -59020,6 +59041,7 @@ def _checkFileIdEntityDomainAccess(fileIdEntity, useDomainAdminAccess):
# gam [<UserTypeEntity>] create drivefileacl <DriveFileEntity> [adminaccess|asadmin]
# anyone|(user <UserItem>)|(group <GroupItem>)|(domain <DomainName>) (role <DriveFileACLRole>)]
# [withlink|(allowfilediscovery|discoverable [<Boolean>])] [expiration <Time>]
# (mappermissionsdomain <DomainName> <DomainName>)*
# [moveToNewOwnersRoot [<Boolean>]]
# [updatesheetprotectedranges [<Boolean>]]
# [sendemail] [emailmessage <String>]
@@ -59035,14 +59057,15 @@ def createDriveFileACL(users, useDomainAdminAccess=False):
fileNameTitle = 'title' if not GC.Values[GC.DRIVE_V3_NATIVE_NAMES] else 'name'
fileIdEntity = getDriveFileEntity()
body = {}
body['type'] = getChoice(DRIVEFILE_ACL_PERMISSION_TYPES)
if body['type'] != 'anyone':
if body['type'] != 'domain':
body['type'] = permType = getChoice(DRIVEFILE_ACL_PERMISSION_TYPES)
if permType != 'anyone':
if permType != 'domain':
body['emailAddress'] = permissionId = getEmailAddress()
else:
body['domain'] = permissionId = getString(Cmd.OB_DOMAIN_NAME)
else:
permissionId = 'anyone'
mapPermissionsDomains = {}
while Cmd.ArgumentsRemaining():
myarg = getArgument()
if myarg == 'withlink':
@@ -59056,6 +59079,9 @@ def createDriveFileACL(users, useDomainAdminAccess=False):
body['role'] = getChoice(DRIVEFILE_ACL_ROLES_MAP, mapChoice=True)
if body['role'] == 'owner':
sendNotificationEmail = _transferOwnership = True
elif myarg == 'mappermissionsdomain':
oldDomain = getString(Cmd.OB_DOMAIN_NAME).lower()
mapPermissionsDomains[oldDomain] = getString(Cmd.OB_DOMAIN_NAME).lower()
elif myarg == 'enforcesingleparent':
deprecatedArgument(myarg)
elif myarg == 'movetonewownersroot':
@@ -59086,6 +59112,18 @@ def createDriveFileACL(users, useDomainAdminAccess=False):
_checkFileIdEntityDomainAccess(fileIdEntity, useDomainAdminAccess)
if 'role' not in body:
missingArgumentExit(f'role {formatChoiceList(DRIVEFILE_ACL_ROLES_MAP)}')
if mapPermissionsDomains:
if permType != 'anyone':
if permType != 'domain':
atLoc = permissionId.find('@')
if atLoc != -1:
mappedDomain = mapPermissionsDomains.get(permissionId[atLoc+1:], None)
if mappedDomain:
body['emailAddress'] = permissionId = f"{permissionId[:atLoc]}@{mappedDomain}"
else:
mappedDomain = mapPermissionsDomains.get(permissionId, None)
if mappedDomain:
body['domain'] = permissionId = mappedDomain
_validatePermissionOwnerType(roleLocation, body)
_validatePermissionAttributes('allowfilediscovery/withlink', withLinkLocation, body, 'allowFileDiscovery', ['anyone', 'domain'])
_validatePermissionAttributes('expiration', expirationLocation, body, 'expirationTime', ['user', 'group'])
@@ -65227,10 +65265,10 @@ def _decodeHeader(header):
# gam <UserTypeEntity> forward message|messages recipient|to <RecipientEntity>
# (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+ [quick|notquick] [doit] [max_to_forward <Number>])|(ids <MessageIDEntity>)
# [subject <String>] [altcharset <String>]
# [subject <String>] [addorigfieldstosubject [<Boolean>]] [altcharset <String>]
# gam <UserTypeEntity> forward thread|threads recipient|to <RecipientEntity>
# (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+ [quick|notquick] [doit] [max_to_forward <Number>])|(ids <ThreadIDEntity>)
# [subject <String>] [altcharset <String>]
# [subject <String>] [addorigfieldstosubject [<Boolean>]] [altcharset <String>]
def forwardMessagesThreads(users, entityType):
def getRecipients():
if checkArgumentPresent('select'):
@@ -65241,7 +65279,7 @@ def forwardMessagesThreads(users, entityType):
checkArgumentPresent({'recipient', 'recipients', 'to'})
recipients = getRecipients()
parameters = _initMessageThreadParameters(entityType, False, 1)
includeSpamTrash = False
addOriginalFieldsToSubject = includeSpamTrash = False
subject = ''
encodings = [UTF8]
while Cmd.ArgumentsRemaining():
@@ -65250,6 +65288,8 @@ def forwardMessagesThreads(users, entityType):
pass
elif myarg == 'subject':
subject = getString(Cmd.OB_STRING)
elif myarg == 'addorigfieldstosubject':
addOriginalFieldsToSubject = getBoolean()
elif myarg == 'altcharset':
encodings.append(getString(Cmd.OB_CHAR_SET))
else:
@@ -65338,6 +65378,12 @@ def forwardMessagesThreads(users, entityType):
if header in message:
del message[header]
message['To'] = msgTo
if addOriginalFieldsToSubject:
msgSubject += ' (Original'
for header in ['From', 'To', 'Date']:
if header in message:
msgSubject += f' {header}: {message[header]}'
msgSubject += ')'
message['Subject'] = msgSubject
try:
result = callGAPI(gmail.users().messages(), 'send',
@@ -67330,12 +67376,6 @@ EMAILSETTINGS_FORWARD_POP_ACTION_CHOICE_MAP = {
'trash': 'trash',
}
# gam <UserTypeEntity> forward message|messages recipient|to <RecipientEntity>
# (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+ [quick|notquick] [doit] [max_to_forward <Number>])|(ids <MessageIDEntity>)
# [subject <String>]
# gam <UserTypeEntity> forward thread|threads recipient|to <RecipientEntity>
# (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+ [quick|notquick] [doit] [max_to_forward <Number>])|(ids <ThreadIDEntity>)
# [subject <String>]
# gam <UserTypeEntity> forward <FalseValues>
# gam <UserTypeEntity> forward <TrueValues> keep|leaveininbox|archive|delete|trash|markread <EmailAddress>
def setForward(users):