mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-04 04:41:35 +00:00
Upgraded gam create course-studentgroups to allow specification of multiple student group titles
This commit is contained in:
@@ -1246,6 +1246,8 @@ Specify a collection of items by directly specifying them; the item type is dete
|
|||||||
<SiteACLScopeList> | <FileSelector> | <CSVFileSelector> | <CSVkmdSelector> | <CSVDataSelector>
|
<SiteACLScopeList> | <FileSelector> | <CSVFileSelector> | <CSVkmdSelector> | <CSVDataSelector>
|
||||||
<SiteEntity> ::=
|
<SiteEntity> ::=
|
||||||
<SiteList> | <FileSelector> | <CSVFileSelector> | <CSVkmdSelector> | <CSVDataSelector>
|
<SiteList> | <FileSelector> | <CSVFileSelector> | <CSVkmdSelector> | <CSVDataSelector>
|
||||||
|
<StringEntity> ::=
|
||||||
|
<StringList> | <FileSelector> | <CSVFileSelector>
|
||||||
<StudentGroupEntity> ::=
|
<StudentGroupEntity> ::=
|
||||||
<StudentGroupIDList> | <FileSelector> | <CSVFileSelector> | <CSVkmdSelector>
|
<StudentGroupIDList> | <FileSelector> | <CSVFileSelector> | <CSVkmdSelector>
|
||||||
<TagManagerAccountPathEntity> ::=
|
<TagManagerAccountPathEntity> ::=
|
||||||
@@ -3396,7 +3398,7 @@ gam print course-works [todrive <ToDriveAttribute>*]
|
|||||||
|
|
||||||
gam create course-studentgroups
|
gam create course-studentgroups
|
||||||
(course|class <CourseEntity>)*|([teacher <UserItem>] [student <UserItem>] [states <CourseStateList>])
|
(course|class <CourseEntity>)*|([teacher <UserItem>] [student <UserItem>] [states <CourseStateList>])
|
||||||
title <String>
|
((title <String>)|(select <StringEntity))+
|
||||||
[csv [todrive <ToDriveAttribute>*] [formatjson [quotechar <Character>]]]
|
[csv [todrive <ToDriveAttribute>*] [formatjson [quotechar <Character>]]]
|
||||||
gam update course-studentgroups <CourseID> <StudentGroupID> title <String>
|
gam update course-studentgroups <CourseID> <StudentGroupID> title <String>
|
||||||
gam delete course-studentgroups <CourseID> <StudentGroupIDEntity>
|
gam delete course-studentgroups <CourseID> <StudentGroupIDEntity>
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
7.20.02
|
||||||
|
|
||||||
|
Upgraded `gam create course-studentgroups` to allow specification of multiple student group titles;
|
||||||
|
multiple student groups can be created in a single command.
|
||||||
|
* `((title <String>)|(select <StringEntity))+`
|
||||||
|
|
||||||
7.20.01
|
7.20.01
|
||||||
|
|
||||||
Added option `showaccesssettings` to `gam [<UserTypeEntity>] print|show chatspaces`. When listing
|
Added option `showaccesssettings` to `gam [<UserTypeEntity>] print|show chatspaces`. When listing
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
|
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
|
||||||
__version__ = '7.20.01'
|
__version__ = '7.20.02'
|
||||||
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
|
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
|
||||||
|
|
||||||
#pylint: disable=wrong-import-position
|
#pylint: disable=wrong-import-position
|
||||||
@@ -51233,7 +51233,7 @@ def printShowClassroomProfile(users):
|
|||||||
|
|
||||||
# gam create course-studentgroups
|
# gam create course-studentgroups
|
||||||
# (course|class <CourseEntity>)*|([teacher <UserItem>] [student <UserItem>] [states <CourseStateList>])
|
# (course|class <CourseEntity>)*|([teacher <UserItem>] [student <UserItem>] [states <CourseStateList>])
|
||||||
# title <String>
|
# ((title <String>)|(select <StringEntity))+
|
||||||
# [csv [todrive <ToDriveAttribute>*] [formatjson [quotechar <Character>]]]
|
# [csv [todrive <ToDriveAttribute>*] [formatjson [quotechar <Character>]]]
|
||||||
def doCreateCourseStudentGroups():
|
def doCreateCourseStudentGroups():
|
||||||
croom = buildGAPIObject(API.CLASSROOM)
|
croom = buildGAPIObject(API.CLASSROOM)
|
||||||
@@ -51243,10 +51243,13 @@ def doCreateCourseStudentGroups():
|
|||||||
courseShowProperties = _initCourseShowProperties(['name'])
|
courseShowProperties = _initCourseShowProperties(['name'])
|
||||||
useOwnerAccess = GC.Values[GC.USE_COURSE_OWNER_ACCESS]
|
useOwnerAccess = GC.Values[GC.USE_COURSE_OWNER_ACCESS]
|
||||||
kwargs = {'courseId': None, 'body': {}}
|
kwargs = {'courseId': None, 'body': {}}
|
||||||
|
titles = []
|
||||||
while Cmd.ArgumentsRemaining():
|
while Cmd.ArgumentsRemaining():
|
||||||
myarg = getArgument()
|
myarg = getArgument()
|
||||||
if myarg == 'title':
|
if myarg == 'title':
|
||||||
kwargs['body']['title'] = getString(Cmd.OB_STRING)
|
titles.append(getString(Cmd.OB_STRING))
|
||||||
|
elif myarg == 'select':
|
||||||
|
titles.extend(getEntityList(Cmd.OB_STRING_ENTITY, shlexSplit=True))
|
||||||
elif _getCourseSelectionParameters(myarg, courseSelectionParameters):
|
elif _getCourseSelectionParameters(myarg, courseSelectionParameters):
|
||||||
pass
|
pass
|
||||||
elif myarg == 'csv':
|
elif myarg == 'csv':
|
||||||
@@ -51256,8 +51259,9 @@ def doCreateCourseStudentGroups():
|
|||||||
csvPF.GetTodriveParameters()
|
csvPF.GetTodriveParameters()
|
||||||
else:
|
else:
|
||||||
FJQC.GetFormatJSONQuoteChar(myarg, True)
|
FJQC.GetFormatJSONQuoteChar(myarg, True)
|
||||||
if 'title' not in kwargs['body']:
|
if not titles:
|
||||||
missingArgumentExit('title')
|
missingArgumentExit('title')
|
||||||
|
jcount = len(titles)
|
||||||
if csvPF and FJQC.formatJSON:
|
if csvPF and FJQC.formatJSON:
|
||||||
csvPF.SetJSONTitles(['courseId', 'courseName', 'JSON'])
|
csvPF.SetJSONTitles(['courseId', 'courseName', 'JSON'])
|
||||||
coursesInfo = _getCoursesInfo(croom, courseSelectionParameters, courseShowProperties, useOwnerAccess)
|
coursesInfo = _getCoursesInfo(croom, courseSelectionParameters, courseShowProperties, useOwnerAccess)
|
||||||
@@ -51272,29 +51276,36 @@ def doCreateCourseStudentGroups():
|
|||||||
if not ocroom:
|
if not ocroom:
|
||||||
continue
|
continue
|
||||||
kwargs['courseId'] = courseId
|
kwargs['courseId'] = courseId
|
||||||
kvList = [Ent.COURSE, courseId, Ent.COURSE_STUDENTGROUP, None]
|
entityPerformActionNumItems([Ent.COURSE, courseId], jcount, Ent.COURSE_STUDENTGROUP, i, count)
|
||||||
try:
|
Ind.Increment()
|
||||||
studentGroup = callGAPI(ocroom.courses().studentGroups(), 'create',
|
j = 0
|
||||||
throwReasons=[GAPI.NOT_FOUND, GAPI.SERVICE_NOT_AVAILABLE, GAPI.NOT_IMPLEMENTED,
|
for title in titles:
|
||||||
GAPI.FORBIDDEN, GAPI.PERMISSION_DENIED],
|
j += 1
|
||||||
retryReasons=GAPI.SERVICE_NOT_AVAILABLE_RETRY_REASONS,
|
kwargs['body']['title'] = title
|
||||||
previewVersion='V1_20250630_PREVIEW',
|
kvList = [Ent.COURSE, courseId, Ent.COURSE_STUDENTGROUP, None]
|
||||||
**kwargs)
|
try:
|
||||||
kvList[-1] = f"{studentGroup['title']}({studentGroup['id']})"
|
studentGroup = callGAPI(ocroom.courses().studentGroups(), 'create',
|
||||||
if not csvPF:
|
throwReasons=[GAPI.NOT_FOUND, GAPI.SERVICE_NOT_AVAILABLE, GAPI.NOT_IMPLEMENTED,
|
||||||
entityActionPerformed(kvList, i, count)
|
GAPI.FORBIDDEN, GAPI.PERMISSION_DENIED],
|
||||||
elif not FJQC.formatJSON:
|
retryReasons=GAPI.SERVICE_NOT_AVAILABLE_RETRY_REASONS,
|
||||||
csvPF.WriteRow({'courseId': courseId, 'courseName': course['name'],
|
previewVersion='V1_20250630_PREVIEW',
|
||||||
'studentGroupId': studentGroup['id'], 'studentGroupTitle': studentGroup['title']})
|
**kwargs)
|
||||||
else:
|
kvList[-1] = f"{studentGroup['title']}({studentGroup['id']})"
|
||||||
csvPF.WriteRowNoFilter({'courseId': courseId, 'courseName': course['name'],
|
if not csvPF:
|
||||||
'JSON': json.dumps(cleanJSON(studentGroup), ensure_ascii=False, sort_keys=True)})
|
entityActionPerformed(kvList, j, jcount)
|
||||||
except GAPI.notFound as e:
|
elif not FJQC.formatJSON:
|
||||||
entityActionFailedWarning(kvList, str(e), i, count)
|
csvPF.WriteRow({'courseId': courseId, 'courseName': course['name'],
|
||||||
except (GAPI.serviceNotAvailable, GAPI.notImplemented) as e:
|
'studentGroupId': studentGroup['id'], 'studentGroupTitle': studentGroup['title']})
|
||||||
entityActionFailedExit([Ent.COURSE, courseId], str(e), i, count)
|
else:
|
||||||
except (GAPI.forbidden, GAPI.permissionDenied) as e:
|
csvPF.WriteRowNoFilter({'courseId': courseId, 'courseName': course['name'],
|
||||||
ClientAPIAccessDeniedExit(str(e))
|
'JSON': json.dumps(cleanJSON(studentGroup), ensure_ascii=False, sort_keys=True)})
|
||||||
|
except GAPI.notFound as e:
|
||||||
|
entityActionFailedWarning(kvList, str(e), j, jcount)
|
||||||
|
except (GAPI.serviceNotAvailable, GAPI.notImplemented) as e:
|
||||||
|
entityActionFailedExit([Ent.COURSE, courseId], str(e), j, jcount)
|
||||||
|
except (GAPI.forbidden, GAPI.permissionDenied) as e:
|
||||||
|
ClientAPIAccessDeniedExit(str(e))
|
||||||
|
Ind.Decrement()
|
||||||
if csvPF:
|
if csvPF:
|
||||||
csvPF.writeCSVfile('Course Student Groups')
|
csvPF.writeCSVfile('Course Student Groups')
|
||||||
|
|
||||||
|
|||||||
@@ -1057,6 +1057,7 @@ class GamCLArgs():
|
|||||||
OB_SPREADSHEET_RANGE_LIST = 'SpreadsheetRangeList'
|
OB_SPREADSHEET_RANGE_LIST = 'SpreadsheetRangeList'
|
||||||
OB_STATE_NAME_LIST = "StateNameList"
|
OB_STATE_NAME_LIST = "StateNameList"
|
||||||
OB_STRING = 'String'
|
OB_STRING = 'String'
|
||||||
|
OB_STRING_ENTITY = 'StringEntity'
|
||||||
OB_STRING_LIST = 'StringList'
|
OB_STRING_LIST = 'StringList'
|
||||||
OB_STUDENTGROUP_ID = 'StudentGroupID'
|
OB_STUDENTGROUP_ID = 'StudentGroupID'
|
||||||
OB_STUDENTGROUP_ID_ENTITY = 'StudentGroupIDEntity'
|
OB_STUDENTGROUP_ID_ENTITY = 'StudentGroupIDEntity'
|
||||||
|
|||||||
Reference in New Issue
Block a user