sfu/canvas-lms — pull request #115 by grahamb (2013-09-04 18:07:42+00:00)
Title: Prevent students from viewing courses on test systems

This plugin displays a "test system" warning and prevents accounts with student roles from accessing courses on non-production systems (for which the plugin has been enabled). Code was provided by Instructure and slightly modified as it contained some multi-tenant specific stuff that we don't need.

When enabled, if an account with a student role tries to access a page within a course, they will receive a message stating that "students are not allowed to access test installations." The warning does not appear on the course's index page, but does for anything else inside a course (including files).

Enabling the plugin is a matter of having a testcluster.yml file in the config directory. The plugin looks for a "test_cluster" property; if the value is truthy then the plugin is enabled. testcluster.yml.(prod,stage,test,edge) files are in place in the /usr/local/canvas shared mount point already. .prod is false, everything else is true.

**TEST PLAN:**
* enable the plugin (add testcluster.yml to canvas/config -> "test_cluster: true")
* log in as yourself
* verify that red bar appears at bottom of page
* verify that you can access everything as an admin
* log in as an instructor
* verify that red bar appears at bottom of page
* verify that you can access the instructor's course(s) normally
* log in as a student
* verify that red bar appears at bottom of page
* verify that you CAN NOT access items within a course