hypothesis / hypothesis/lms

Enable use of privately shared files in Google Workspace in LMS assignments

Open
#928 1 comment 0 reactions 0 assignees View on GitHub
feature request Google Drive Spike
Dominant language
Python
Stars
53
Forks
16
Avg merge
14d 5h
Merged PRs (30d)
14

Description

/todo Write reqs

- See https://github.com/hypothesis/product-backlog/issues/1189
- But instead, for Google Workspace Shared Drives or users disabled from sharing publicly
- This is slightly different from how the story is posed below
- While the implementation proposed below is likely the best one there are alternatives
- Share with service account, and open every file as service account
- Host the files (runs into copyright issues)

---

> # :warning: :point_down: ARCHIVE :point_down: :warning:

This is to confirm the plan outlined below will work, and hopefully scope the work involved.

## User story
As a teacher at Example University, I want to use the Hypothesis LMS app in Sakai to assign readings to my students. The PDFs for these readings reside in a [Team Drive](https://drive.google.com/drive/shared-drives), and the university library mandates that these PDFs are set so that "anyone at Example University with the link can view," rather than "anyone with the link can view."

When I launch the Google picker I need to:
- See files shared with me by the university library
- Select one of these files to include in my assignment, _without changing the privacy settings of the file_

## Additional information
In https://github.com/hypothesis/lms/issues/632 we explored possible implementations. Robert came up with:

Make Google Drive files work similar to Canvas files, serving PDFs in some way other than serving the download URL.

A sketch of the changes this would involve:

- [ ] Enabled shared drive support ([as outlined here](https://developers.google.com/drive/api/v3/enable-shareddrives))
- [ ] Change the Google Drive assignment selection flow so that it records the file ID and the fact that it came from Google Drive in the LTI launch URL, but doesn't make the file publicly accessible. In other words, it would generate an LTI launch URL similar to the one it generates for Canvas files.

- [ ] Change the assignment launch flow for Google Drive files so that instead of directly rendering a PDF in Via, it instead:
- Gets the user's authorization to access their files in Google Drive
- Fetches the file content
- Serves the file content inside PDF.js, eg. using a blob URL or by passing a data buffer directly to PDF.js
This would involve changes to the `BasicLtiLaunchApp` mini-SPA in the client and we'd also need to either give Via the ability to load content from a file buffer (eg. transferred from the LMS app to Via via `postMessage`) or add PDF.js directly to the LMS app.

This will allow any file that is shared with the student's Google account, eg. by being shared with "anyone at " to be used as an assignment without needing public sharing.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.