Skip to content

Commit

Permalink
Updated gam print courses and gam <UserTypeEntity> move events
Browse files Browse the repository at this point in the history
  • Loading branch information
taers232c committed May 28, 2021
1 parent ce9de93 commit 5ddcd40
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
12 changes: 12 additions & 0 deletions src/GamUpdate.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
6.03.27

Updated `gam print courses` to handle the following error.
```
ERROR: 503: serviceNotAvailable - The service is currently unavailable.
```

Updated `gam <UserTypeEntity> move events <UserCalendarEntity> <EventEntity> to|destination <CalendarItem>`
to correct an incorrect error message from Google.
* Incorrect message: Move Failed: You need to have reader access to this calendar.
* Correct message: Move Failed: You need to have writer access to both calendars.

6.03.26

Updated the following commands to allow selection of archived users from a source group.
Expand Down
26 changes: 17 additions & 9 deletions src/gam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"""

__author__ = 'Ross Scroggs <[email protected]>'
__version__ = '6.03.26'
__version__ = '6.03.27'
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'

import base64
Expand Down Expand Up @@ -27788,7 +27788,12 @@ def _moveCalendarEvents(origUser, user, origCal, calIds, count, calendarEventEnt
except GAPI.notACalendarUser as e:
entityActionFailedWarning([Ent.CALENDAR, calId], str(e), i, count)
break
except (GAPI.forbidden, GAPI.requiredAccessLevel, GAPI.invalid, GAPI.cannotChangeOrganizer, GAPI.cannotChangeOrganizerOfInstance) as e:
except GAPI.requiredAccessLevel as e:
# Correct "You need to have reader access to this calendar." to "You need to have writer access to both calendars."
entityActionFailedWarning([Ent.CALENDAR, calId, Ent.EVENT, eventId, Ent.CALENDAR, newCalId],
str(e).replace('reader', 'writer').replace('this calendar', 'both calendars'),
j, jcount)
except (GAPI.forbidden, GAPI.invalid, GAPI.cannotChangeOrganizer, GAPI.cannotChangeOrganizerOfInstance) as e:
entityActionFailedWarning([Ent.CALENDAR, calId, Ent.EVENT, eventId, Ent.CALENDAR, newCalId], str(e), j, jcount)
except (GAPI.serviceNotAvailable, GAPI.authError):
entityServiceNotApplicableWarning(Ent.CALENDAR, calId, i, count)
Expand Down Expand Up @@ -34721,9 +34726,10 @@ def _getCourseAliasesMembers(croom, courseId, courseShowProperties, teachersFiel
try:
aliases = callGAPIpages(croom.courses().aliases(), 'list', 'aliases',
pageMessage=pageMessage,
throwReasons=[GAPI.NOT_FOUND, GAPI.NOT_IMPLEMENTED, GAPI.FORBIDDEN],
throwReasons=[GAPI.NOT_FOUND, GAPI.FORBIDDEN, GAPI.SERVICE_NOT_AVAILABLE, GAPI.NOT_IMPLEMENTED],
retryReasons=[GAPI.SERVICE_NOT_AVAILABLE],
courseId=courseId, pageSize=GC.Values[GC.CLASSROOM_MAX_RESULTS])
except (GAPI.notFound, GAPI.notImplemented):
except (GAPI.notFound, GAPI.serviceNotAvailable, GAPI.notImplemented):
pass
except GAPI.forbidden:
ClientAPIAccessDeniedExit()
Expand All @@ -34734,9 +34740,10 @@ def _getCourseAliasesMembers(croom, courseId, courseShowProperties, teachersFiel
try:
teachers = callGAPIpages(croom.courses().teachers(), 'list', 'teachers',
pageMessage=pageMessage,
throwReasons=[GAPI.NOT_FOUND, GAPI.FORBIDDEN],
throwReasons=[GAPI.NOT_FOUND, GAPI.FORBIDDEN, GAPI.SERVICE_NOT_AVAILABLE],
retryReasons=[GAPI.SERVICE_NOT_AVAILABLE],
courseId=courseId, fields=teachersFields, pageSize=GC.Values[GC.CLASSROOM_MAX_RESULTS])
except GAPI.notFound:
except (GAPI.notFound, GAPI.serviceNotAvailable):
pass
except GAPI.forbidden:
ClientAPIAccessDeniedExit()
Expand All @@ -34746,9 +34753,10 @@ def _getCourseAliasesMembers(croom, courseId, courseShowProperties, teachersFiel
try:
students = callGAPIpages(croom.courses().students(), 'list', 'students',
pageMessage=pageMessage,
throwReasons=[GAPI.NOT_FOUND, GAPI.FORBIDDEN],
throwReasons=[GAPI.NOT_FOUND, GAPI.FORBIDDEN, GAPI.SERVICE_NOT_AVAILABLE],
retryReasons=[GAPI.SERVICE_NOT_AVAILABLE],
courseId=courseId, fields=studentsFields, pageSize=GC.Values[GC.CLASSROOM_MAX_RESULTS])
except GAPI.notFound:
except (GAPI.notFound, GAPI.serviceNotAvailable):
pass
except GAPI.forbidden:
ClientAPIAccessDeniedExit()
Expand Down Expand Up @@ -46440,7 +46448,7 @@ def updateDriveFileACLs(users, useDomainAdminAccess=False):
useDomainAdminAccess = True
else:
unknownArgumentExit()
if (removeExpiration or 'expirationTime' in body) and 'role' not in body:
if 'role' not in body:
missingArgumentExit(f'role {formatChoiceList(DRIVEFILE_ACL_ROLES_MAP)}')
printKeys, timeObjects = _getDriveFileACLPrintKeysTimeObjects()
i, count, users = getEntityArgument(users)
Expand Down

0 comments on commit 5ddcd40

Please sign in to comment.