An open source plugin for Instructure Canvas to connect to Google Drive.
Clone or download
andersoncardoso Merge pull request #30 from learningtapestry/shrink_gdrive_font
shrink asset to 16x16 to match other Canvas editor buttons. Fixes #29
Latest commit 6e4e2fb Jun 14, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.cloud66 Enable assets precompile Feb 28, 2018
assets shrink asset to 16x16 to match other Canvas editor buttons. Fixes #29 Jun 11, 2018
config Add QA environment to database config Mar 29, 2018
db Embed lti-link-item for grading on homework assignments Mar 5, 2018
lib Use a more restrict scope for google oauth2 Apr 16, 2018
log 100% coverage + refactor to keep paths consistent Feb 28, 2018
models Add more docs + improve some namings Mar 19, 2018
public Add Google domain verification file Mar 30, 2018
spec Add tests and docs for resource selection Mar 21, 2018
views Allow resource/link selection for embeding content Mar 21, 2018
.env.template Use redis for context sessions and for google auth tokens Mar 14, 2018
.gitignore 100% coverage + refactor to keep paths consistent Feb 28, 2018
.rspec Increase test coverage Feb 27, 2018
.rubocop.yml Authenticate LTI requests using oauth1 Feb 8, 2018
.ruby-version Start LTI App for canvas-gdrive integration Feb 7, 2018
.scss-lint.yml Add asset management and improve organization Feb 16, 2018
.snyk Ignore warning for unnafected vuln Feb 28, 2018
Gemfile Add pry gem to all builds Apr 2, 2018
Gemfile.lock Update bundler lock file Apr 2, 2018
LICENSE Initial commit Feb 7, 2018
README.md Add link to wiki Apr 2, 2018
Rakefile Enable assets precompile Feb 28, 2018
app.rb Add tests and docs for resource selection Mar 21, 2018
config.ru Fix asset pipeline flow, add vue and zepto to handle new components Feb 16, 2018
init.rb Fix asset pipeline flow, add vue and zepto to handle new components Feb 16, 2018

README.md

Known Vulnerabilities

CanvasLMS / GoogleDrive integration

Simple LTI app for providing google-drive integration into CanvasLMS

Features:

  • allow educators to link/embed gdrive files into course content
  • allow students send gdrive files as part of assignment

Getting Started

This app uses:

  • Ruby 2.5.0 + Sinatra
  • PostgreSQL 9.6
  • Redis
  1. Create a Google app on the Google Developer Console.

  2. Enable access to the Drive API for the newly created Google app

  3. Create credentials for accessing the Google app

  • When asked where you will be calling the API from, select "Web server"
  • When asked what data you will be accessing, select "User data"
  • Under "Authorized Javascript origins" enter the URL where this app is deployed
  • Under "Authorized redirect URIs" enter the same URL as above, with /google-auth/callback at the end

This will give you the OAuth2 credentials to be used in this app to access the Google app.

  1. Go to the "Domain verification" tab and verify the domain this app is running on.

To configure this app with your new credentials, first create your .env file by running cp .env.template .env and then modify with your new Google credentials:

SESSION_SECRET=[Generate a string here with SecureRandom.hex(32)]
GOOGLE_KEY=[Your Google client ID]
GOOGLE_SECRET=[Your Google client secret]

Install dependencies and create the database:

bundle install
bundle exec rake db:create db:migrate

For deploying (not development) you should also precompile assets: bundle exec rake assets:clean assets:precompile

Run

For running the server: ruby app.rb

you can have an interactive console with the app configured and imported, using: bundle exec rake console

Launching from Canvas LMS

To launch the Google Drive Connector app from a Canvas instance, see this wiki:

https://github.com/learningtapestry/canvas-google-drive-connector/wiki/Configuring-the-LTI-application

tests

uses Rspec: bundle exec rspec

you can check the coverage report on coverage/index.html

API

Config

  • / [GET]

    • simple root endpoint (used mostly for smoke testing)
    • response: plain/text with the project name
  • /config.xml [GET]

    • The LTI app configuration inside canvas is done via an XML document using the IMS Common Cartridge specification
    • https://www.imsglobal.org/cc/index.html.
    • response: application/xml with the config.

Credentials management

  • /credentials/new [GET]

    • render new credentials form
  • /credentials [POST]

    • build new credentials pair and return to the user

Google Oauth2

used internally

  • /google-auth [GET]

    • Redirect to Google's authorization page if we don't have the credentials yet.
  • /google-auth/callback [GET]

    • handle the callback from google after authorization

LTI endpoints

All LTI launch requests are done via POST

  • /lti/gdrive-list [POST]

    • Renders a google drive list.
    • This action is used internally on XHR requests, after we've accessed a LTI launch url.
    • authentication: session user, google credentials and csrf token
    • Params:
      • folder_id : list the contents of this folder
      • search_term : term to search on the user's drive file names
      • action : which kind of action should be enabled when a file is selected
  • /lti/course-navigation [POST]

  • /lti/editor-selection [POST]

    • Launch url for editor selection (button inside the rich-text editor fields)
    • The select action shows the options for link or embed the file in the content.
    • authentication: lti request and google credentials
    • Params: LTI Launch (http://www.imsglobal.org/specs/ltiv1p0/implementation-guide) from Canvas
  • /lti/resource-selection [POST]

  • /lti/link-selection [POST]

    • Launch url for resource selection (module -> add item -> external tool)
    • The link_resource action generate a lti-link for the resource selected.
    • authentication: lti request and google credentials
    • resource-selection and link-selection are the same.
    • Params: LTI Launch (http://www.imsglobal.org/specs/ltiv1p0/implementation-guide) from Canvas
  • /lti/resources/:file_id [POST]

  • /lti/homework-submission [POST]

  • /lti/documents [POST]

    • Generate an HTML snapshot of the google drive document
    • authentication: session user, google credentials and csrf token
    • Params:
      • file_id : the gdrive file id
  • /lti/documents/:file_id [POST]

LICENSE

This project is licensed under GPL3