Commit Graph

76 Commits

Author SHA1 Message Date
Cody Cutrer b0cdd06de4 drop rails 5.2
Change-Id: I35858513f03b30ad5b19a175ba5ff098b4ca921c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258982
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-02-19 02:41:07 +00:00
August Thornton 940f47ec07 add granular permissions for course files
Note: we'll want to re-run the data fix-up when we're ready to turn
on the feature flag permanently; in hopes to capture any differences
made to course files permissions between now and then.

Modified the files_controller quota and api_quota permission checks
to make them more lenient in regards to accepting any or all of the
files permissions role overrides. This allows legacy grouping and
new granularized files permissions to live in harmony and be modified
without causing unauthorized errors on the quota resource.

This commit will cover the backend permissions required to granularize
files / folders permission calls, however there will be a follow-up
ps to clean up the course file page to hide elements the user might
not be authorized to use.

closes FOO-130
refs FOO-1501
flag = granular_permissions_course_files
[fsc-max-nodes=18]
[fsc-timeout=30]

Test Plan:
  - Run the migration and make sure there are no errors
  - With the granular_permissions_course_files FF turned off,
    course sections and REST API should work the same with this patch
    set checked out as it does in beta/production
  - Some things to check:
    * How it acts as a teacher, student, and public user
      in course files/folders and personal files/folders
      with the various settings above toggled to different states
    * How it acts as a teacher, student, and public user
      in discussions, modules, content migrations/import/exports
      (RCE should behave similarly throughout the site)
  - With the granular_permissions_course_files feature flag turned on
    course files/folders and REST API should work as expected. The same
    list checked above should be done so again, but this time:
    * Should only be able to upload or add folders if the
      Course Files - add permission is enabled for the user's role
    * Should only be able to manage file access, usage rights, move,
      or rename course files/folders if the Course Files -
      edit permission is enabled for the user's role
      • Check Toolbar header at the top of Course files
      • Check Cog (hamburger menu) to the right of each file/folder
      • Check Usage Rights Indicator under usage rights column
        that can be found in course and group file pages. This can
        be enabled under course settings if not available
    * Should only be able to delete course files/folders if the
      Course Files - delete permission is enabled for the user's role
    * Any given user/role should have full access to their respective
      personal files/folders regardless of granted permissions. The
      same also applies to a group context with some caveats
      • Should not be able to modify file access in a group context
      • Should not be able to modify usage rights in personal files
    * A student enrollment not granted any file permissions (the default)
      should only be able to _view_ and _download_ files unless granted
      additional access from an authorizing role
    * REST API works as expected
    * UI works as expected with no additional javascript errors

Change-Id: Ieb2d10915c274959e8da4c623f7aba11d3540c2b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/253777
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: August Thornton <august@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
2021-01-27 17:02:38 +00:00
Ethan Vizitei 4df5771fa4 downgrade file reading errors to info/warn
closes FOO-1270
flag=none

TEST PLAN:
  1) force file reads from s3 to fail
  2) export content
  3) log errors happen, but not sentry errors

Change-Id: Ie8681f648e3427831fa9ba3f1dbff8f32918f6c1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/255584
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-12-18 18:36:48 +00:00
Ethan Vizitei a9d9da13ad downgrade several expected error locations
refs FOO-1125
flag=non

TEST PLAN:
  1) stats for things like ImperiumTimeouts should still
     end up in datadog
  2) sentry errors for the target error types should disappear

Change-Id: I6e97c04e3f6fcc3545b10418511934c89f20a419
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251536
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-10-30 16:46:01 +00:00
Cody Cutrer 06763dd519 add # frozen_string_literal: true for lib
Change-Id: I59b751cac52367a89e03f572477f0cf1d607b405
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251155
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-10-27 20:49:50 +00:00
Simon Williams 4693861183 remove action_controller_test_process shim
it was used for two things:
- file_fixture_upload, which now comes from
  ActionDispatch::TestProcess::FixtureFile
- Rack::Test::UploadedFile which comes from the rack-test gem

Change-Id: I27957b410fcf4677dac77aed1b00b04dfd1b012e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/222555
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-01-10 18:54:48 +00:00
Cody Cutrer 4f267c41b9 various rails 6 fixes
Change-Id: I9a2da0fe619170e6a297ad5d1b9dd3e11daf3782
Reviewed-on: https://gerrit.instructure.com/206054
Tested-by: Jenkins
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2019-08-21 19:47:32 +00:00
James Williams 4fad68a03b grab attachments from correct shard for submission downloads
closes #ADMIN-2751

Change-Id: Ic78a59b5a5cc0b8bae11c19e2b2188d99664db5f
Reviewed-on: https://gerrit.instructure.com/200859
Tested-by: Jenkins
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2019-07-11 19:21:20 +00:00
Derek Bender 531e5dbc58 Scope speed grader to new setting
Closes: GRADE-2245

Test Plan:
- Given a course with new gradebook enabled
- Given Filter by Student Group is enabled
- Given at least two groups with students in each
- Given the new gradebook has "Group Filters" selected in the
  View -> Filters menu

- When the new filter has the first group selected
- Then the Speed Grader page for any assignment will only display
  students from the first group

- When the second group filter is selected
- Then the Speed Grader page for any assignment will only display
  students from the second group

- When the filter is changed to "All Student Groups"
- Then the Speed Grader page for any assignment will display all
  students like when this feature is disabled

- Given a course with new gradebook enabled
- Given Filter by Student Group is disabled
- Given at least two groups with students in each
- Given the new gradebook has "Group Filters" selected in the
  View -> Filters menu

- When the filter is changed to the first group
- Then the Speed Grader page for any assignment will display
  all students

- When the filter is changed to the second group
- Then the Speed Grader page for any assignment will display
  all students

- When the filter is changed to "All Student Groups"
- Then the Speed Grader page for any assignment will display
  all students

Change-Id: I530f12bbef0cdd799c15f159366cbae3d9b0eb1e
Reviewed-on: https://gerrit.instructure.com/198809
Tested-by: Jenkins
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Keith Garner <kgarner@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: Keith Garner <kgarner@instructure.com>
2019-07-03 20:08:00 +00:00
Michael Brewer-Davis f25abf25d4 restrict eportfolio export to downloadable files
closes SEC-2197, OUT-3131

Test plan:
- open network debugging tools
- create a course as teacher
- add a file to the course and unpublish it
- in network tools find the unpublish request
  and note the file id
   PUT /api/v1/files/<id>
- create an eportfolio as student
- add an image in the rich text editor
- in network tools find the file creation
  request and note the file id
   GET /api/v1/files/<id>/create_success
- save eportfolio
- find save request
   POST /eportfolios/.../entries/...
- copy request as cURL
- paste into terminal, add cookie header
   -H 'Cookie: canvas_session=...'
  where canvas_session can be found in the
  Application debugging tools
- change the file id of the image uploaded
  to match the unpublished image in the course.
  it will be buried in URL-encoded HTML
- submit the curl request
- verify that the request succeeded by reloading
  the eportfolio and noting that the image is
  a broken link
- go back to the eportfolio dashboard
- download the eportfolio as zip file
- unzip the file
- verify that the unpublished file is not present in the
  zipped contents

Change-Id: Id5c7384035e7b91a35bc427871b167777d0d9528
Reviewed-on: https://gerrit.instructure.com/196518
Tested-by: Jenkins
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: Augusto Callejas <acallejas@instructure.com>
Product-Review: Jonathan Fenton <jfenton@instructure.com>
2019-06-05 21:42:31 +00:00
James Williams 3f7dbdcc4f anonymize downloaded online_text_entry submissions
test plan:
* create an assignment with anonymous grading enabled and
 text entry submission type
* submit to the assignment as a student
* as an teacher, download all submissions as a zip
* the file should not list the student name

closes #GRADE-2076

Change-Id: I237a4e7c8bba71a3c1a5384dabaef9d30f23014b
Reviewed-on: https://gerrit.instructure.com/185683
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Keith Garner <kgarner@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: Keith Garner <kgarner@instructure.com>
2019-05-23 18:53:01 +00:00
Jeremy Stanley 621df59efe remove harmful characters when downloading submissions
test plan:
 - as a student, upload a file to your files
 - rename it to have a slash in its name
 - submit it to an assignment
 - as a teacher, download submissions for the assignment
   in a zip fie
 - re-upload the zip file and it should associate the file
   with the prior submission

fixes ADMIN-2391

note that the ids in the filename are what Canvas uses to
reassociate the file from the zip with its submission;
the only reason we included the name was for the teacher's benefit.
using a slash in the name puts the file in a subdirectory and
breaks the link, so we replace slashes with underscores.

Change-Id: I389088c853775f52028157db7c7c003863df889f
Reviewed-on: https://gerrit.instructure.com/180808
Tested-by: Jenkins
QA-Review: Carl Kibler <ckibler@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Carl Kibler <ckibler@instructure.com>
2019-02-19 20:06:22 +00:00
Neil Gupta 2f603de0f4 ensure user can read eportfolio files before zipping them up
fixes OUT-2999

test plan:
* create an attachment as an admin in a course. Note its id
* create another course and masquarade as a teacher
* create an eportfolio and edit a page with the following text
	/files/#{attachment_id}/download
* save the page
* download the contents of the eportfolio as a zip file
* that zip file should not contain the admin's file

Change-Id: I902c33d19c976e6ce615d689550172fa1fa3a91e
Reviewed-on: https://gerrit.instructure.com/181362
Tested-by: Jenkins
Reviewed-by: Matthew Berns <mberns@instructure.com>
QA-Review: Matthew Berns <mberns@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
2019-02-12 00:42:44 +00:00
Spencer Olson c5ee434ff5 make anonymous grading checks consider muted status
Unmuting an anonymous assignment will now cause that assignment to show
in the UI as though it is not anonymous. In addition, posting grades for
a moderated anonymous assignment will now cause that assignment to show
in the UI as though it is not anonymous.

closes GRADE-1310
closes GRADE-1313

Test Plan:
1. Verify unmuting an anonymous assignment causes that assignment to no
   longer be anonymized in the UI. You can do this by spot checking
   gradebook (old/new/individual) and SpeedGrader. In addition,
   re-muting an unmuted anonymous assignment should cause the assignment
   to become anonymized in the UI.
2. Verify posting grades for a moderated, anonymous assignment causes
   that assignment to no longer be anonymized in the UI (even if the
   assignment is muted).

Change-Id: I113c61b4e7fa0eb8909448d8ba7cffb22600e17c
Reviewed-on: https://gerrit.instructure.com/156151
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Tested-by: Jenkins
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-07-10 16:24:26 +00:00
Adrian Packel 9d89795983 Replace old anonymous-grading course flag checks
Remove the old Anonymous Grading course flag; update checks for it to
instead look at whether a given assignment (or quiz) is anonymous.

closes GRADE-957

Test plan:

Course flag:
- Check that the relevant course flags are now 'Anonymous Grading (OLD)'
  (which should not be able to be enabled) and 'Anonymous Grading' (the
  "new" setting previously called Anonymous Marking)
- The old flag should be hidden for any course or account that does not
  have a value in the database for it already

Assignments:
- Create an anonymous assignment and a non-anonymous assignment
- Test the assignments:
  - SpeedGrader: student names should be visible for the non-anonymous
    assignment only
  - Log in as a student and upload submissions for the assignments
    created above; as a teacher, download them and make sure that the
    anonymous assignment does not include the students' names in
    its filenames

Anonymous surveys:
- Create two quizzes with a type of Graded (or Ungraded) Survey, and
  enable anonymous submissions for one of them but not the other
- Log in as one or more students and answer both surveys
- As a teacher, open the "Moderate This Survey" link for each survey:
  - Student names should be shown for the non-anonymous survey but
    replaced by "Student 1" and so forth for the anonymous survey
  - The history page (accessible by clicking the name of a student who
    has filled out the survey) should show the student's name for the
    non-anonymous survey but only "Student" for the anonymous survey

Change-Id: Iaa0bc4e40b938056b8e9dfd6d13aff7e6b2ee7bd
Reviewed-on: https://gerrit.instructure.com/152985
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-06-18 16:16:33 +00:00
Michael Jasper 816c4bad2d Upload attachment to inst-fs, eportfolio export
closes RECNVS-362
closes RECNVS-363

Test plan:
- with instfs configured and enabled:
  - log into canvas and navigate to the users eportfolio
  - dowload the eportfolio
  - verify that the eportfolio was
    - created successfully
    - download from the <instfs domain>/files
  - verify that the instfs logs show
    - a post of the eportfolio to instfs
    - a get of the eportfolio from instfs

Change-Id: Ia27ca9811598cea180432e730ae8d5163a720036
Reviewed-on: https://gerrit.instructure.com/143050
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Product-Review: Michael Jasper <mjasper@instructure.com>
2018-03-21 19:45:35 +00:00
Jeremy Stanley 118c552002 allow unicode characters submission zip files
test plan:
 - have an assignment that accepts file uploads
 - have a student with non-ASCII characters in the name
   (e.g., accented or Japanese, etc.)
 - submit as the student
 - as the teacher, on the assignment page right sidebar,
   download submissions (ensure jobs are running)
 - the non-ASCII characters should not be filtered out
   of the student's name in the filename

notes:
 - spaces and commas and hyphens, etc., will still
   be filtered out of names; this was done for
   other reasons and has not changed. the difference
   is we use [[:word:]] instead of \w, which includes
   word-like Unicode general categories and not just
   alphanumerics
 - windows explorer prior to windows 8 does not
   properly support unicode filenames in zip files.
   there's not much we can do about this, other than to
   suggest using a third-party zip program that does.
   (ASCII filenames are still handled correctly)
 - the student's name is not included if anonymous grading
   is turned on

fixes ADMIN-770

Change-Id: I1cb06a4277ee330e02dabab1d7d7cae01d80822a
Reviewed-on: https://gerrit.instructure.com/140996
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
Tested-by: Jenkins
QA-Review: Jon Willesen <jonw+gerrit@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2018-02-21 16:08:36 +00:00
Landon Wilkins f1359d33e2 da licença part 27
add consistent license headers to all source files
(ruby, coffeescript, javascript)

except for vendor files

Change-Id: I331826e3e3be8b7d73bbf4f6afe3a79ec1340f54
Reviewed-on: https://gerrit.instructure.com/110051
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-04-27 21:53:31 +00:00
Jeremy Stanley b5320c6f15 make Download Submissions respect anonymous grading
test plan:
 - enable anonymous grading in a course
 - have an assignment that accepts file submissions
 - make some submissions as students
 - as a teacher,
   1. "Download Submissions" from the assignment page;
   2. ensure the files inside the zip don't reveal the
      student's name in their filenames;
   3. re-zip and ensure "Re-upload Submissions" works

fixes CNVS-30564

Change-Id: I9b6145d6b51492fc9c08d263298c6341b73d3f51
Reviewed-on: https://gerrit.instructure.com/85980
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-07-27 00:11:42 +00:00
Matthew Berns ca3b7120a2 fix ePortfolios not zipping if there's a blank page
fixes CNVS-26303

test plan
- go to a users ePortfolio
- add some pages and edit their content
  (https://community.canvaslms.com/docs/DOC-2745)
- add a page, but do not alter default content
 ("No Content Added Yet" will be default content)
- attempt to download ePortfolio as a zip file
- it should be successful

note:
  if this is a small course the download should take
  no more than 1 minute or so. If you're waiting for
  an abnormally long period of time, it's likely
  something has gone wrong.

Change-Id: Ied8d53e224496ac8f092b5ef950a28aed980ea59
Reviewed-on: https://gerrit.instructure.com/70520
Tested-by: Jenkins
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Matt Berns <mberns@instructure.com>
2016-02-05 17:26:22 +00:00
James Williams f62911d1d2 rails 4.2: fix initializer specs
refs #CNVS-26056

Change-Id: I6bd8f15c375afc1bbb49d156949c1a92bd1c01d3
Reviewed-on: https://gerrit.instructure.com/70497
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-01-20 15:18:12 +00:00
Keith Garner 1a3a166b08 display download submissions button on screenreader gradebook
Screenreader gradebook now displays the "Download All Submissions"
button if any of the allowed submission types on an assignment is
downloadable. An empty zip file is now created if an assignment allows
both downloadable and non-downloadable submissions and all submissions
are of the non-downloadable variety.

fixes CNVS-26135

test plan:
 - As a teacher create an assignment with text and media type
   submissions selected
 - As a student submit the assignment
 - As a teacher go to the individual view gradebook
 - Select the assignment under Content Selection
 - Look for Download All Submissions button
 - Click "download all submissions"
 - If the student submitted a text type, expect to see it in the zip
   file.
 - If the student submitted a media type, expect an zip file with no
   entries.

Change-Id: I84913d6950ce8a8db28460c0ea26a2469dec86d9
Reviewed-on: https://gerrit.instructure.com/70437
Reviewed-by: Strand McCutchen <smccutchen@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Christi Wruck
2016-01-19 17:45:08 +00:00
Ryan Taylor f0f4407ab4 Allows downloading all submissions for a hard concluded course
This will return a zip of ALL submissions made to that assignment if the
course is concluded, since there are no enrollments.

Closes CNVS-25884

Test Plan:
 - Create file-upload submission content
 - Close course
 - Download all assignment submissions and get a not 22 byte zip file
   with the submission content inside of it.

Change-Id: I18b07f9ad55753f9d66855412350150c46922650
Reviewed-on: https://gerrit.instructure.com/69536
Tested-by: Jenkins
Reviewed-by: Davis McClellan <dmcclellan@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2016-01-08 23:06:15 +00:00
John Corrigan 2169acc8cb add new permission for reading folder contents during export
fixes CNVS-25980

The existing `:read_contents` permission check takes into account
whether or not the user in question can view the `Files` menu item,
which is a little different than being able to actually see files in a
subfolder. Since menu-visiblity has nothing to do with content access in
an export, we will handle this as a separate permission.

test plan:
- As a teacher, add files to a course and include some nested
  directories containing files.
- Go to course settings > navigation.
- Hide the Files menu item from the student.
- As a student in the course, export the course as an ePub.
- Observe that nested files are included in the ePub, or in the
  associated zip directory.

Change-Id: Ie547b89c0676a648454bd4a9f80b00c62ac531e6
Reviewed-on: https://gerrit.instructure.com/69533
Tested-by: Jenkins
Reviewed-by: Matt Berns <mberns@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: John Corrigan <jcorrigan@instructure.com>
2016-01-05 17:19:08 +00:00
Derek Bender 3964ba5228 check for entry content before calling methods
fixes CNVS-24745

test plan:
- create an ePortfolio (with no content)
- download the ePortfolio
- delete ePortfolios
- create an ePortfolio with one submission as a page
- add some content to the page including an embeded image
- download the ePortfolio

Change-Id: I7eb85d804159fd6cc2c1db3b731c63b9dd0f26be
Reviewed-on: https://gerrit.instructure.com/67889
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Derek Bender <djbender@instructure.com>
2015-12-03 02:17:44 +00:00
Davis McClellan ff7dc08ff7 change file download names for MatLab compatability
fixes CNVS-9683

test plan:
- download an file upload assignment's submissions
- ensure that the names match the MatLab guidlines
  "Script file names and function file names are required to use
  the same semantic rules as MATLAB identifiers: must begin with
  a letter (upper or lower case English alphabet), which can then
  be followed by any combination of digits, underscore, or upper
  or lower case English alphabet letters, and the total name
  length must be at most 63."

Change-Id: I66d19dbd7b29aba9ed4a0fb4fdf154369f75ae70
Reviewed-on: https://gerrit.instructure.com/66481
Tested-by: Jenkins
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
QA-Review: Landon Holmstead <lholmstead@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2015-11-05 22:29:47 +00:00
Keith Garner 0722793bf5 rich text embedded images now included in eportfolio zip file
When an ePortfolio page has a rich text section with an embedded
image, the image appears as a seperate file in the .zip download and
appears inline in the page's html file.  Because of this, an
ePortfolio user will be able to embed images in rich text sections.

fixes CNVS-21702

test plan:
- Have (or upload) an image stored in the Files page
- Create a new ePortfolio
- Click on the default Welcome page and then click on Edit This Page
- Select Rich Text Content from the Add Content menu
- In the editor, embed your image from your Canvas files
- Click "Save Page"
- Return to the ePortfolio main page via the navagation breadcrumbs
- Click "Download the contents of this ePortfolio as a zip file"
- Unzip the downloaded zip file and observe that the image is there
  along with Home_Welcome.html.
- Open the "Home_Welcome.html" file in a web browser.
- Observe the image inline on the page.

Change-Id: I0638df03d94eab3e37eb91b9daeb898c20cc42d5
Reviewed-on: https://gerrit.instructure.com/61159
Tested-by: Jenkins
Reviewed-by: Dylan Ross <dross@instructure.com>
Reviewed-by: Cody Poll <cpoll@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Christi Wruck
2015-08-27 16:54:47 +00:00
Keith Garner a5320105ba uploaded files appear in downloaded eportfolio pages
When an ePortfolio page has an attached image or file, the image or
file appears as a seperate file in the .zip download and appears on
the page's html file.  Because of this, an ePortfolio user will be
able to access the file from the html page instead of the filesystem.

fixes CNVS-21703

test plan:
- Create a new ePortfolio
- Click on the default Welcome page and then click on "Edit this page"
- Select Image/File Upload from the Add Content menu
- Select "choose file," select any image file from your desktop, and
  then click "Select/Upload File"
- Repeat the Image/File upload procedure, this time picking any
  non-image file.
- Click "Save Page"
- Return to the ePortfolio main page via the navagation breadcrumbs
- Click "Download the contents of this ePortfolio as a zip file"
- Unzip the downloaded zip file and observe that the files you uploads are there along with Home_Welcome.html.
- Open the "Home_Welcome.html" file in a web browser.
- Observe the image inline as a link to the file on disk and the non-image file as a "Click here to Download..." link.
- Observe both links work

Change-Id: I37fdc47df199733d21de67b7d220f746d54f12b5
Reviewed-on: https://gerrit.instructure.com/60697
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2015-08-21 15:41:11 +00:00
John Corrigan 3dcaea5a18 update CC::WebResources#add_course_files to filter files by permission
fixes CNVS-21391

The content export tool is being updated so that it consders the
provided user's rights, so that the CC export can be used for the new
epub generation tool.

This PS updates CC::WebResources#add_course_files to pass a user
instance to the ContentZipper instance it uses to zip up a course's
files, so that the ContentZipper can determine if the user has the
correct permissions to see the files.

Also, we update ContentZipper so that a user can be provided via
attr_writter.

test plan:
- Regression test for content export tool files functionality.

Change-Id: Ic5edecef28d60d9517ce3a67bc8aef5c5dade9cc
Reviewed-on: https://gerrit.instructure.com/59440
Tested-by: Jenkins
Reviewed-by: Brian Finney <bfinney@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Cameron Sutter <csutter@instructure.com>
2015-08-06 19:01:09 +00:00
Cody Poll 37d64e9822 Deleted upload submissions no longer download
When zipping assignment submissions for download, deleted files should not be
added to the zip.

fixes CNVS-12167

There is an edge case that is covered - that of a small course where maybe 1 or
2 submissions may exist, and the file for each has been deleted. By marking
success if the file is deleted, we keep it from erroring out, and will download
an empty zip. Jenkins shows no regressions for this, so we should be good.

Test Plan:
  A: As a teacher:
    1. Create a file-upload assignment as a teacher
  B: As a student:
    1. Submit a file upload for the assignment
    2. Delete the upload (/users/:user_id/files)
  C: As a teacher:
    1. View the students submission in speed-grader
    2. Click download icon
    3. Verify that a page not found error is displayed
    4. Return to assignment page
    5. Click "Download Submissions"
    6. Verify that the zip file downloaded
    7. Double-click on zip file
    8. Verify that the resulting file does not contain the deleted file
       The resulting file may simply be a .cfgz or similar file. This signifies
       an empty zip file in this case.

Change-Id: I6344cadb92d4e13bd23ade4c4e34111751bcecd1
Reviewed-on: https://gerrit.instructure.com/53574
Tested-by: Jenkins
Reviewed-by: Strand McCutchen <smccutchen@instructure.com>
QA-Review: Adrian Foong <afoong@instructure.com>
Product-Review: Cody Poll <cpoll@instructure.com>
2015-06-25 16:19:01 +00:00
Ethan Vizitei 1004e66540 get sentry into canvas
closes CNVS-6016

No more error reports!  (soon)

this commit builds up sentry integration through the new
Canvas::Errors module, along with other things that need
to happen on every exception.  ErrorReports
should now get pushed towards just being used for representing
a complaint a user filed via the get help form.

I fixed about half the things that got linted as well
while I was in here, but because this touches to much
I fear divergence from tackling too many (I think we
can safely say it's "better than we found it")

I left a lot of the infrastructure for error reports in place
until other commits for plugins can be merged

TEST PLAN:
 1) setup your raven.yml config file with the dsn for our
  sentry install
 2) force an error to happen in a request response cycle.
 3) see the error in sentry
 4) force an error to happen in a job
 5) see the error in sentry
 6) statsd increments shoudl still fire
 7) for the moment, an error report should still get created.

Change-Id: I5a9dc7214598f8d5083451fd15f0423f8f939034
Reviewed-on: https://gerrit.instructure.com/51621
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2015-04-13 22:26:15 +00:00
Jeremy Stanley f477bdf11c skip broken files when downloading a zip
instead of freezing indefinitely

(with better file browsing off)

also fix progress reporting, which was completely broken and
always read 5%

test plan:
 - with better file browsing turned _off_
 - have a course with several files (on the order of 100)
 - break one of the files in the console, like so
     att = Attachment.find(...)
     att.update_attributes(root_attachment_id: nil, filename: 'broken!')
 - try to download a zip file containing course files
   - the progress bar should function
   - you should get a zip file containing all the files
     except the one you broke

fixes CNVS-19635

Change-Id: I75bdb80129401d55dddbc12c2367239fb99f18b7
Reviewed-on: https://gerrit.instructure.com/51434
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2015-04-02 16:52:48 +00:00
Ryan Shaw e2d1903bd3 remove references to eportfolio_static.css since it didn't exist
while doing some css maintenance, I came across a
file "app/stylesheets/vendor/eportfolio_static.scss"
and thought "where does this get used". after grepping
the whole project, the only place that mentioned something
like it was lib/content_zipper.rb.  but that was
looking for a file in public/styleshseets/static/...
so it would not have found this one and just hit the
"rescue nil".  So it was code that didn't do anything.

Even if it did figure out how to link to the right
css file, the css rules inside of it seemed to target
element ids that no longer exist. I think this is
just an orphan file that never got deleted.

Test plan:
* download a zip of your eportfolio (however you do that)
* the html output should look the same as before this commit

Change-Id: I85026b6c4a5319b60a8986f558e429ebb1e019e3
Reviewed-on: https://gerrit.instructure.com/49402
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2015-02-25 17:22:06 +00:00
Cameron Matheson a1f400e754 remove scribd
closes CNVS-13380
closes CNVS-8057
closes CNVS-5156

Test plan:
  * scribd should no longer exist
  * document previews should work in canvadocs

Change-Id: I5ac60c3e986f030c3aea88e32d2992ec7b1c7a08
Reviewed-on: https://gerrit.instructure.com/37895
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-09-11 18:42:15 +00:00
Cameron Sutter e5569c1310 fix eportfolio download
fixes CNVS-15147

test plan:
 - create an eportfolio for a user
 - download the eportfolio
 > it should download

Change-Id: I674333fed77d159201e35b7c2e6ca12a033e4856
Reviewed-on: https://gerrit.instructure.com/40412
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cameron Sutter <csutter@instructure.com>
2014-09-05 19:47:19 +00:00
James Williams 5b2d0cb97f selective content export api
test plan:
* test the undocumented content_list api endpoint:

 api/v1/courses/:course_id/content_list

which returns the same content list that would be shown by the
selective_content endpoint of a pending course copy content migration

with no 'type' parameter, it should return a list of
exportable categories and urls for each expandable type

with a type parameter (e.g. content_list?type=context_modules), it
should send a list of items with their titles and ids (asset strings)

these ids can be used to select the content for the export

* use the content_exports_api create endpoint to create a
 common_cartridge export, but add an additional argument,
 "select" (equivalent to the "copy" parameters for
 the content_migration api)

e.g. api/v1/courses/:course_id/content_exports?
 select[all_wiki_pages]=1&
 select[context_modules][context_module_42]=1
(replacing :course_id and :module_id)

* also try using arrays of ids as a parameter

e.g. api/v1/courses/:course_id/content_exports?
 select[context_modules][]=42&
 select[context_modules][]=43

 this should create a package that only contains the
 specified content, and any course files referenced in
 html content (confirm by re-importing)

closes #CNVS-13502

Change-Id: I5bdcdc8255b30c5f78585dc335d25eb19bd5a7c0
Reviewed-on: https://gerrit.instructure.com/36655
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2014-07-02 19:39:57 +00:00
Nick Cloward e9595976c1 clean up permission calls for grants_rights?
refs: CNVS-11425

Change-Id: Ia0145e4b4d1da9e0f83a1845647ce203b3586057
Reviewed-on: https://gerrit.instructure.com/34280
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-06-19 18:10:30 +00:00
Joshua Simpson ae814421e0 namespace all of quiz into quizzes module
This commit namespaces the rest of quiz related code into a Quizzes
namespace: controllers, views, models, and classes that previously lived
under lib/ that are Quiz-related.

Test plan:

Full regression test on all quiz related items

refs CNVS-10457

Change-Id: If54b61213945056539e03271a936d233abb66188
Reviewed-on: https://gerrit.instructure.com/29351
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2014-02-18 22:17:13 +00:00
Joshua Simpson 1e81ea7caa move quiz into quizzes namespace as a precursor to enginifying
fixes CNVS-10679
this commit refactors quiz into a quizzes namespace. it contains various
shims to facilitate the data migration of polymorphic relationships
('Quiz' -> 'Quizzes::Quiz').  JIRA contains several tickets linked to
the above tickets in regards to removing these shims after the data
migration, as well as the strategies on reverting the shims once the
data migration is complete.
Change-Id: I30c566d60a87af6ee83e9d0041fdcb909ead6a89
Reviewed-on: https://gerrit.instructure.com/28573
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2014-01-24 00:08:46 +00:00
Anthus Williams 40c5c1f5f7 fix for rails3 refactoring of TestUploadedFile
in rails 3, ActionController::TestUploadedFile has
been moved to Rack::Test::UploadedFile. This commit
simply updates uses of TestUploadedFile to work
with this new structure

Change-Id: Ib31159c635f033a13908608dffeea88c8f719086
Reviewed-on: https://gerrit.instructure.com/28234
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Anthus Williams <awilliams@instructure.com>
QA-Review: Anthus Williams <awilliams@instructure.com>
2014-01-17 17:53:18 +00:00
Cameron Matheson 348c406750 fix submission downloads where sortabe_name is a number
fixes CNVS-10230

Test plan:
  * make a group assignment
  * make groups that with numbers for names (no
    letters/spaces/punctuation/etc)
  * download the submissions
  * upload the submissions (the submissions should be attached to
    comments on the original submissions)

Change-Id: I6b47e9ad16c91e6b3e48a10b2a345eba6b9f9f20
Reviewed-on: https://gerrit.instructure.com/28227
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2014-01-09 00:26:23 +00:00
Jeremy Stanley 1e29a97ee0 rubyzip 1.0.0 upgrade
test plan: zip functionality should continue to work, including:
 * course exports and imports
 * zip file uploads
 * zip submissions

also, the selenium dependency on rubyzip 1.0.0 is resolved
and we're making progress toward > 4GB exports

Change-Id: I58c5b0644b1e7fbb289821c9c0901f00750988de
Reviewed-on: https://gerrit.instructure.com/25474
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
2013-11-22 19:23:34 +00:00
Jacob Fugal fadf690fe0 require appropriate file for testing uploads
refs CNVS-9166

test-plan: N/A

Change-Id: Ie9ed104579961f0af67b9453ecc43670d48ecbac
Reviewed-on: https://gerrit.instructure.com/25736
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-10-29 19:02:55 +00:00
Cameron Matheson b469af93cc make Assignment#group_students return distinct students
fixes CNVS-7823, CNVS-7847

Test plan:
  * enroll a student in multiple sections
  * make a group assignment
  * comment on the group assignment submission for the student with
    multiple sections
  * the student should receive one copy of the comment (not multiple)

Change-Id: I26f44ef054fdb136f180c949d0676fc0168827a8
Reviewed-on: https://gerrit.instructure.com/23886
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
2013-09-03 23:09:18 +00:00
Cameron Matheson 1bf441899d fix submissions.zip filenames frd (and fix broken spec)
fixes CNVS-7636

This fixes a failing spec and also resolves some remaining edge cases
where _\d+_ could have inappropriately happened.

Test plan:
  * Make an assignment with students named something like:
    - student 1
    - student 2!
  * Download the submissions zip
  * Make sure uploading them works (their submissions are not ignored)

Change-Id: Iad0de754f618a68f815780b89df0aaa9ea7afd16
Reviewed-on: https://gerrit.instructure.com/23490
QA-Review: Amber Taniuchi <amber@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2013-08-20 21:13:46 +00:00
Cameron Matheson e2671a41bd make submission downloads group-friendly
closes CNVS-6875

Test plan:
  * download submissions for a group assignment where students are not
    graded individually
  * you should only see one submission per group
  * also make sure the speedgrader still shows students and groups
    correctly

Change-Id: I8063320d0b06d0bb78f8070e6de05e10e9a8889e
Reviewed-on: https://gerrit.instructure.com/23378
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2013-08-19 04:56:17 +00:00
Cameron Matheson 65586fd39c properly sanitize user names when zipping assignments
Test plan:
  * download submissions for an assignment in a class that has a student
    with the sortable_name "Some 999 Student"
    * the assignment should be one that takes uploaded submissions
  * upload the downloaded submissions (as if you were commenting on the
    attachments)
  * the attachment for "Some 999 Student" should be accepted

Change-Id: I26b195c9e958ae79b1b777f797bdd235a9d585b1
Reviewed-on: https://gerrit.instructure.com/23350
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2013-08-15 23:03:11 +00:00
Cody Cutrer e852ebb6da delay creating jobs in other dbs until transaction completes
this prevents the job from accessing data that hasn't committed yet,
as well as many instances of it waiting for the first transaction to
release a lock cause the two transactions are referencing the same
data

test plan:
 * general smoke test in a production environment (since lots of
   things run sync in non-production environments)

Change-Id: I7b132b6119f60e38ae1ba4d17dea18ac49114960
Reviewed-on: https://gerrit.instructure.com/21168
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
2013-06-17 20:19:08 +00:00
Stanley Stuart 5ad43c33bd add ability to download all file uploads for a quiz as a zip
test plan:
  - as a few different students, take a quiz with at least two questions
    that are file upload questions. Answer each question as each
    student.
  - as the teacher, you should see a "Download All Files" button on the
    right on the Quiz Show Page next to "Quiz Stastics" and "Moderate
    This Quiz".
  - You should get a pop up that successfully downloads all the zips
    (make sure you have delayed jobs running!). Make sure all the files
    you submitted as the students are there, with the student's name,
    user id, question number, and attachment display name in the
    filename of each file.

closes CNVS-3048

Change-Id: I23cb2d4262bb0446476eeac4fdcb356e604e6a05
Reviewed-on: https://gerrit.instructure.com/20495
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Eric Berry <ericb@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
2013-05-16 21:14:19 +00:00
Cody Cutrer 5ffbcbeb05 arel-ify lib
excluding api_find, which needs more work

refs CNVS-4706

Change-Id: I013d0660ff2b8dbe2abf6a5c973bd1203f432f99
Reviewed-on: https://gerrit.instructure.com/18921
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-04-01 19:12:22 +00:00