mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-18 07:23:00 +00:00
Added Post multiple groups API
This commit is contained in:
@@ -45,10 +45,12 @@ class GroupListAPIHandler(_GroupAPIHandler):
|
|||||||
async def post(self):
|
async def post(self):
|
||||||
"""POST creates Multiple groups """
|
"""POST creates Multiple groups """
|
||||||
model = self.get_json_body()
|
model = self.get_json_body()
|
||||||
self._check_group_model(model)
|
|
||||||
if not model or not isinstance(model, dict) or not model.get('groups'):
|
if not model or not isinstance(model, dict) or not model.get('groups'):
|
||||||
raise web.HTTPError(400, "Must specify at least one group to create")
|
raise web.HTTPError(400, "Must specify at least one group to create")
|
||||||
groupnames = model.get("groups",[])
|
|
||||||
|
groupnames = model.pop("groups",[])
|
||||||
|
self._check_group_model(model)
|
||||||
|
|
||||||
created = []
|
created = []
|
||||||
for name in groupnames:
|
for name in groupnames:
|
||||||
existing = orm.Group.find(self.db, name=name)
|
existing = orm.Group.find(self.db, name=name)
|
||||||
|
Reference in New Issue
Block a user