edina / nbexchange

External exchange for nbgrader
Other
6 stars 2 forks source link

Retrieve email in get_current_user #174

Closed ykazakov closed 1 month ago

ykazakov commented 1 month ago

According to README, nbexchange requires the following user information:

def get_current_user(self, request):
    return {
      "name": "username",
      "full_name": "Joe Bloggs",
      "course_id": "cool_course_id",
      "course_title": "cool course",
      "course_role": "Student",
      "org_id": 1,
      "cust_id": 2,
}

Part of this information is used to add/update users in the nbgrader database upon collection of submissions:

https://github.com/edina/nbexchange/blob/985796a553a56f4ee39f74f46ab8577a9c263728/nbexchange/plugin/collect.py#L151

Since, in addition to first_name and last_name, email is also an optional user information, it would be nice to also allow retrieving and storing email addresses with the get_current_user function so that they could be later displayed in Formgrader > Manage Students.

perllaghu commented 1 month ago

I've been thinking about this.... and about the issue of GDPR and "personal information" - and an email address is even more identifiable.

Given that most things call list, I don't really want to expose the email address more than I need..... so I think it [and the lms_user_id also in the gradeboook.student table] should only be released in collect [where it's used by the plugin to create a student record]

Thoughts?

ykazakov commented 1 month ago

Given that most things call list, I don't really want to expose the email address more than I need.

Does list show full names of students? I thought it only shows student ids.

I am not suggesting to replace student id with email, just to use email similarly to full name as additional optional user information, mainly because it is used in nbgrader database.

.... so I think it [and the lms_user_id also in the gradeboook.student table] should only be released in collect [where it's used by the plugin to create a student record]

How is it done with full names? Are they stored in nbexchange database or they are only requested by the plugin upon collection?

Thoughts?

To avoid storing student data in nbexchange database, one probably would need 2 plugins:

  1. One plugin (used by nbexchange service) should determine user_id from the submission request.

  2. Another plugin (used by instructor) should retrieve additional student info (for nbgrader database) from user_id during collection.

perllaghu commented 1 month ago

In the master branch, the collect handler will now return an email address [and lms_user_id] if they are given

See https://github.com/edina/nbexchange/blob/master/nbexchange/handlers/collection.py#L29