autolab / Autolab

Course management service that enables auto-graded programming assignments.
http://www.autolabproject.com/
Apache License 2.0
752 stars 213 forks source link

New API endpoint needed to handle creating new users #2057

Open dpaceoffice opened 7 months ago

dpaceoffice commented 7 months ago

We're attempting to automate roster population in Autolab for our courses, but we've encountered an issue: there's no way to use the API to create users. Initially, we were POSTing to /api/v1/courses/{course_name}/course_user_data, but this approach fails if the user doesn't already exist, as it won't create a non-existent user the way the user model's function, self.roster_create, does when rosters are uploaded via the GUI.

Therefore, we either need an endpoint for user management (/api/v1/user_controller) capable of more than just retrieval - specifically, one that can create, update, and destroy users. Alternatively, we could modify /api/v1/courses/{course_name}/course_user_data to call the user's self.roster_create function, rather than merely reporting that a user doesn't exist.

damianhxy commented 7 months ago

Thanks for this feature request and we'll take a look into it!

As a workaround in the meantime, if your script has access to the Autolab instance, you could consider using the rake task rake admin:create_user[email,password,first_name,last_name] to create missing users programmatically