Commit Graph

1308 Commits

Author SHA1 Message Date
August Thornton 0c439d0847 add backend permission changes for manage courses granulars
closes FOO-1745

flag = granular_permissions_manage_courses

test plan:
 • see g/261805 for test plan

Change-Id: I683db559d923b93b8dfb9cfd7552d90a15a48ff9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261094
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: August Thornton <august@instructure.com>
2021-04-30 21:29:00 +00:00
Jacob Burroughs fae809a968 Fix consul recursion with 1 return
Change-Id: I5c1a9f260afc56887881f98cdab08ad3a25c45f3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263980
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2021-04-30 16:38:32 +00:00
Jacob Burroughs 5f02893cb5 Fix diplomat recursion
Since we cache by full key anyway, there is no good reason
to convert it into a recursive hash only to convert it right back

Change-Id: Ifb356e38a2ac5e6e0477ebc5913e0d9128622489
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263932
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2021-04-29 19:53:43 +00:00
Jacob Burroughs bca8bd4629 Migrate to diplomat
Change-Id: I82363dedbd2397830a9beadf33b1cc59123136c8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263429
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2021-04-29 17:00:51 +00:00
Jeremy Stanley dfed7a0371 fix issues using timestamp as a pagination bookmark
when a timestamp is round-tripped through a page parameter,
it comes back as a string which was failing to line up with
the bookmarked row for one of two reasons:
 1. the date string was in local time (with a UTC offset
    that the database was ignoring)
 2. the date string truncated the fractional seconds part

solve both issues by explicitly converting timestamps to
UTC and preserving fractional seconds

test plan:
 - have two courses in different shards selected in your
   calendar, having assignments with due dates in both
   (at least 50 such assignments in one of the courses)
 - all the assignments should show up on your calendar
   (just once each)

fixes LS-2156

flag = none

Change-Id: Ia2010e08653520923e1c3f05d17697e1a3cd8826
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263546
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Eric Saupe <eric.saupe@instructure.com>
QA-Review: Eric Saupe <eric.saupe@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-04-28 20:47:28 +00:00
Eric Saupe 3ff97df0e9 Modify index and show views for K5 mode
This change removes the sidebar and breadcrumbs from show and index
actions in course controllers to simplify the views.

fixes LS-2063
flag=canvas_for_elementary

test plan:
- Enable Canvas for Elementary for the account
- Navigate to the course settings page
- Navigate to all pages listed in the left nav
- Verify the left nav and breadcrumbs are missing on all course pages for
 students but not for teachers

Change-Id: Id8e448ee2b3bd981f4376de5cf827d728da15763
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262428
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeff Largent <jeff.largent@instructure.com>
QA-Review: Jeff Largent <jeff.largent@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
2021-04-21 18:21:41 +00:00
Evan Battaglia 803c8d028f CanvasHttp: support for a max response body length
Test plan:
- Run the following and check that it raises a ResponseTooLarge error.
  resp = CanvasHttp.get('http://example.com', max_response_length: 1000)
- Run the following and make sure no error is raised and resp.body is a
  String with the full response body:
  resp = CanvasHttp.get('http://example.com', max_response_length: 2000)
- Now let's try to get a file that Net::HTTP splits up into more than
  one chunk. Add a `puts "CHUNK #{chunk.size}"` into the
  `response.read_body` block in `read_body_max_length`.
- Find a big test file on the interwebs (actually the chunk size seems
  to be only a couple kb so it doesn't have to be that big), or possibly
  host one yourself locally with `python -m SimpleHTTPServer 8000`
- Make it fail by setting max_response_length to be less a little than
  the total length. Make sure more than one chunk was fetched.
- Make it succeed by setting max_response_length to be a little more than
  the total length. Make sure more than one chunk was fetched. Make sure
  the body is intact (e.g. fetch without a max_response_length, then
  check resp1.body == resp2.body)

refs INTEROP-6709
flag=none

Change-Id: I0929dfd32a4f4e9bfb6b18c58c5decac265123af
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263126
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2021-04-19 17:40:03 +00:00
Ed Schiebel c445c8a85c Strip ridiculous css values MathJax might have added
closes MAT-42
flag=new_math_equation_handling

test plan:
This is not easy to test because you really should trigger whatever MathJax does. You could copy/paste
some bad HTML from a prod quiz into the RCE html editor, or use something like this:

<div style="border: 1px dashed red;">
  <span style="clip: rect(1e+07em, -9.999e+06em, -1e+07em, -999.997em);">this is a clip</span>
  <span style="display: inline-block; overflow: hidden; vertical-align: -1.17e+05em;">this is a vertical-align</span>
</div>

but ^that is what I used to test, so maybe you should try something else.

  - have some bad CSS in your RCE html, AND some math so MathJax is loaded
  > expect the crazy clip and vertical-align css attributes are stripped
    from the offending elements.

Change-Id: Icae13dc8656d2f9918c2b5315bd10089010a8029
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262868
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-04-14 21:19:29 +00:00
Wagner Gonçalves c48795a53c add migration claim to LTI 1.3 launches
We're adding the https://purl.imsglobal.org/spec/lti/claim/lti1p1
migration claim that will support the `user_id` field.

closes INTEROP-6649
flag=none

test-plan:
* Have a LTI 1.3 tool installed;
* Launch the tool and verify the JWT contains the lti1p1 claim with the
  user_id;

Change-Id: I9278a6b22c69336b8ef35190c09c171e9b62dce7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262421
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Wagner Goncalves <wagner.goncalves@instructure.com>
2021-04-14 19:34:24 +00:00
Wagner Gonçalves 6972ad309a change sub and lti11_legacy_user_id claim to not required
When launching a 1.3 tool as an unauthenticated user (possible in
public courses), Canvas sends the `sub` claim as
`https://canvas.instructure.com/public_user`

However, the sub claim should really be omitted when launching a tool as
an unauthenticated user, according to the IMS spec.

http://www.imsglobal.org/spec/lti/v1p3/#user-identity-claims

The `lti11_legacy_user_id` claim should follow the same behavior of
user_id laim in an LTI 1.1 tool. As `user_id` is empty when launching
a LTI 1.1 tool in a public course with unauthenticated user we're
changing the `lti11_legacy_user_id` claim to return an empty string
instead of `https://canvas.instructure.com/public_user`.

closes INTEROP-6599
flag=none

test-plan:
* Have a public course published;
* Install an LTI 1.3 tool with course navigation placement enabled, you
  can use the this change in the LTI 1.3 Test Tool
  https://gerrit.instructure.com/c/canvas-lms/+/262530, which disable
  sub claim validation;
* As an unathenticated user, access the tool in the course navigation,
  and verify that the tool should launch and the `sub` claim should not
  be present and the `lti11_legacy_user_id` claim should em empty;
* As an athenticated user, access the tool in the course navigation,
  and verify that the tool should launch and the `sub` and
  `lti11_legacy_user_id` claims should be present;

Change-Id: I78bb64e3d898f44fcc401a43d054909032ef5420
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262530
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Wagner Goncalves <wagner.goncalves@instructure.com>
2021-04-12 21:09:34 +00:00
Ahmad Amireh 4243097b21 rename some things
fixes FOO-1265

[skip-eslint=true]
[pin-commit-analytics=7e49eefd7f59cbf43fd03bf8957bbbfa76f8d9d5]
[pin-commit-demo_site=adade2e38e46a358a4643cd3db2fe5ccffe39ec5]
[pin-commit-instructure_misc_plugin=47a3161102b0611af56d134fbd0c828ddc1b8abf]
[pin-commit-migration_tool=0dbac2f5b421d894395605ce4b583ef0f7d60b22]
[pin-commit-multiple_root_accounts=cc96d28c0d59bbe47acc64de4fdd8e1d2b029805]

Change-Id: I14c07f20bd260cf0de1f48ceb70b3c2313edf2d2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258807
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
2021-04-06 01:12:49 +00:00
Cody Cutrer baa224946d add an `ordered` scope to acts_as_list, and use it
Change-Id: Ib7756119e01f4c54a68da2424d647fd902e407cd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261979
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-03-31 21:48:10 +00:00
Cody Cutrer 6d14259077 add frozen_string_literal comment to engines and gems
Change-Id: Ifb661509145c16937c9f1c28803687b7cec4b3a4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261815
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2021-03-30 18:14:15 +00:00
Michael Brewer-Davis a9ff89f509 make LearningOutcomeResult soft-deleteable
refs OUT-4247

Test plan:
- ensure results from aligned rubrics and from quizzes
  are visible in the learning mastery gradebook

Change-Id: Ie9731f2c702f91b3da2ce4d8ae43f7045ee5509e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260613
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
2021-03-23 17:16:41 +00:00
Ethan Vizitei c5988b8cc5 Initial work on getting zeitwerk loader running
refs FOO-1712
flag=none

 - drop bad directories from autoloading (jsx)
 - re-inflect some things that zeitwerk doesn't
   know by default (InstFS, etc)
 - add environment variable trigger for enabling
   zeitwerk loading
 - move samesite transition cookie to app middleware
   so we don't try to reload middleware
 - use zeitwerk.rb shim to pre-load things
   that are not correctly loaded by their own
   gems

TEST PLAN:
  1) everything continues to work fine
  2) for local development, if you use the
     CANVAS_ZEITWERK env var, you get zeitwerk
     autoloading (which is probably still broken)

Change-Id: I55a0db84034133240698bf4ff0cc8d225ec181a6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260674
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>
2021-03-16 19:55:12 +00:00
Cody Cutrer d69aa5ab29 avoid duplicate const warning in canvas_sanitize gem
Change-Id: Ic4f8f386213e5049bd2ad94b8cb8ce5aeaeba1c3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260713
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
2021-03-16 15:32:25 +00:00
Wagner Gonçalves fabc4c3053 enable to submit homework assignment zip files from windows
closes INTEROP-6605
flag=none

When a user was submitting a zip file with `application/x-zip-compressed`
extension, we weren't accepting and returning `unable to find extension`
error.

So, we're changing the `canvas_mimetype_fo` gem to work with multiple
mime_type for the same extension like zip: application/zip,
application/zip-compressed, and application/x-zip-compressed.

And changing the `infer_file_extension` method to try to find the
extension from the filename when we don't know the content_type given.

test-plan:

test-plan
* Have a Course recorded;
* Have a Student enrolled in this Course;
* Have an Assignment recorded to this Course;
* In the course settings, you have to allow the assignment enhancements
  feature;
* Logged as a student, you should be able to submit the homework by
  uploading a zip file with different mime types like `application/zip`
  and `application/x-zip-compressed`;
* Accessing rails console, you should be able to validate if the
  Attachment.content_type corresponds to the file you submitted;
* To upload a zip file with `application/x-zip-compressed` mime type I
  used parallels to have a Windows running in Mac;
* You should be able to submit the homework after disabling the
  assignment enhancements feature;

Change-Id: If3a0dd3da67072c6292e65c551d83be9e235e7f2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260472
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ryan Hawkins <ryan.hawkins@instructure.com>
QA-Review: Wagner Goncalves <wagner.goncalves@instructure.com>
Product-Review: Karl Lloyd <karl@instructure.com>
2021-03-15 17:19:41 +00:00
Ahmad Amireh e36dcc8474 fix specs for gems/canvas_i18nliner
refs FOO-1617
refs FOO-1408

this is a clash between 5a9a4f3 and ef4f3af

Change-Id: I2a37fac530f5bd60173f88dda8c69793417f6f7f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260388
Tested-by: James Butters <jbutters@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2021-03-10 21:06:57 +00:00
Ahmad Amireh ef4f3af11b specify i18n scope for handlebars in JSON files
fixes FOO-1617
flag  = none

[pin-commit-analytics=ea50e2b0d4fce306e05bb90c696904885a3d51da]
[pin-commit-instructure_misc_plugin=9ecb5066b058e4bf166058a43d4a26f8ac7a685b]
[pin-commit-migration_tool=7d1f2b2801502bb427dcebcc7c15398f5801cfe1]
[pin-commit-multiple_root_accounts=0c81b2b76e8463a2ab8c873230934d3ec79337f9]

each handlebars template is now expected to be accompanied by a sibling
.json file that specifies the i18n scope to use for {{#t}} calls in that
template:

    {
      "i18nScope": "foo.bar"
    }

this lets us rename the file without affecting the scope

when a template is missing this property (or the json file) and makes a
call to {{t}} or {{#t}}, the build will abort with a helpful message to
direct the author to address the issue

in the process, this also removed two dead-code templates:

- app/views/jst/calendar/appointmentGroupList.handlebars
- app/views/jst/calendar/schedulerRightSideAdminSection.handlebars

== test plan

- go to user preferences page and change locale to something other than
  english that you can verify, and then verify the strings on that page
  are still translated

- remove one of the *.handlebars.json files that were introduced by
  this patch, run webpack and verify the build fails

Change-Id: Ia745dc2000615b55866abc570aa08b5cdbfae93e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258936
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
2021-03-10 20:30:19 +00:00
Ahmad Amireh 5a9a4f3470 (re) decentralize i18nliner configuration
refs FOO-1408
flag = none

This reverts commit c904d83673.
Original commit 9af1badd2f.

I've also made an adjustment where you may only include a directory and
not a specific file so that we don't make it possible to configure
outside of an ".i18nrc" file (a measure to eliminate surprises that's
all)

before:

    { "include": [ "path/to/dir/.i18nrc" ] }

now:

    { "include": [ "path/to/dir" ] }

:: test plan

run "rake canvas:compile_assets" and visit any page with JavaScript
text, that text should display correctly

Change-Id: I320ec4056270647835035f45501d310b18d9cb25
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258178
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
2021-03-10 18:52:49 +00:00
Ahmad Amireh 09e6058f72 sort auto-generated en.yml locale file
fixes FOO-1569
flag  = none

The tree of phrases coming out of the i18n:generate rake task is now in
alphabetical order. This should have absolutely no effect on the
structure of the tree, only on the order in which the keys appear in
each branch.

:: test plan ::

There are no surprises related to text in the UI; any page should do,
things should look the same, you don't see "bar" in place of "foo"

Change-Id: I683c5ee352149128a05e36bcb07646aca15ad3a3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258170
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>
2021-03-10 17:11:26 +00:00
Pat Renner 19f85c334c include clarifications with parent standards
closes OUT-4250
flag=none

test-plan:
- Import Common Core Standards into your account
  > guid: "964E0FEE-AD71-11DE-9BF2-C9169DFF4B22"
- View Common Core > Math > Grade 1 > .. 1.G Geometry >
  .. 1.G.A > .. G.A.2
   > verify that the end of the description includes 'Students
     do not need to learn formal names ...' as this
 was a clarification standard that was rolled up into its parent

Change-Id: Ib7851e26430ffd82e238a94a6069278450b8a463
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259829
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Martin Yosifov <martin.yosifov@instructure.com>
Product-Review: Jody Sailor
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
2021-03-08 23:15:39 +00:00
Simon Williams 6c927afb63 Revert "dig output on inst-fs resolution failure"
closes FOO-1676

This reverts commit 37239e6b60.

Change-Id: I189958c033b823b0f0656904856239807d651ceb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260206
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
2021-03-08 20:33:49 +00:00
Ethan Vizitei 02f14d341f treat openssl cipher error as auth failure
closes FOO-1670

also fix canvas_security porting failures

TEST PLAN:
  1) encrypt a token with some invalid key
  2) you should get a standard auth failure
     when you present it
Change-Id: Id635f9889fd5a595bc74dfdf89757b9f535434c5

Change-Id: I53334c82e6e3b8637f4d8142d49a46351464ed60
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260038
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-03-05 18:36:54 +00:00
Ethan Vizitei c3460682fc pull canvas_errors out into a gem
refs FOO-1648
flag=none

move general module code to "gems"
along with specs.

Leave shim in canvas to avoid breaking
things while callsites get changed.

change some limited callsites
from Canvas::Errors to CanvasErrors
that were doing spec stubbing that required
at least one namespace change anyway

generate readme describing common use
cases.

TEST PLAN:
  1) we still send stuff to sentry

Change-Id: I0111afc21e9e8c6604370885b4c750186b96175f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260035
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-03-05 17:00:50 +00:00
Cody Cutrer 3d2ecf3075 be sure to call super in error initializer
Change-Id: I2dee6e884319b4ee43fcbfbf813a2c8fbcbcb599
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259970
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-03-05 02:19:36 +00:00
Ethan Vizitei 82d824c587 default dynamic_settings logger to Rails.logger
Some parts of the app depend on parsing
STDOUT, which can result in surprises
if we put things in STDOUT because of
an unexpected initialization order.

Change-Id: Iab12602861d7e32fa5aea5c1a71dd05d0005b89b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259943
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-03-04 20:40:02 +00:00
Ethan Vizitei b33b74151b stage 1: audits engine extract
refs FOO-1644
[fsc-propagate=false]

  - create engines directory
  - put one empty-ish engine in there
  - add general engines dependency to
     gemfile construction
  - update build pipeline to run tests all engines
     just like gems
  - add engines directory to jenkins-cache build
  - get rspec running successfully with a dummy app
     inside the audit engine
  - stop failing with no message if environment
     unloadable in css config
  - generally set pattern in build artifacts and in
     code organization for pulling out an engine

Change-Id: I8650f5e0aa7d72556d2f02156886d2b503a111fb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258988
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-03-04 20:27:06 +00:00
Ethan Vizitei a50bc58212 move EventStreamLogger to event_stream gem
refs FOO-1644
flag=none

the auditors engine needs access to this class,
and it is pretty tightly coupled to event_stream
anyway because of the intended use case.

no shim needed because of limited callsites

TEST PLAN:
  1) auditors continues to log inserts
  2) gem specs pass

Change-Id: Iefc3dfd43fef9f32f1b281352091b8dc3caff7d4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259841
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-03-03 19:14:24 +00:00
August Thornton 1d016a31e5 add eportfolio account report
This adds an ePortfolio report that can be ran on a root account
or any sub-account. It defaults to giving a report of all active
eportfolios that reside under that institution. There is an
option to run the report to collect ePortfolios for users that
have no enrollments or just ePortfolios that are in a deleted
state.

closes FOO-1647
flag = none

test plan:
 • Navigate to Account Settings --> Reports
 • Verify the newly added "Eportfolio Report" appears
 • Clicking on the (?) gives further details about the report
 • There are two configuration options for the report
    - Only include ePortfolios from users with no enrollments
    - Only include ePortfolios that have been removed
 • The default report with no options selected will generate
   all active ePortfolios for the given institution
 • The first config option should only include ePortfolios from
   users with no enrollments
 • The second option should only include deleted ePortfolios
 • Using both options will generate a report of deleted
   ePortfolios from users with no enrollments

Change-Id: I9d8f4cdbe354a483380d8b80256cfb976fa5a953
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259515
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
2021-03-03 17:58:23 +00:00
Ethan Vizitei dd58f89f2c request_context as a gem
refs FOO-1649

Pull out middleware for request
context to a gem so that other
engines in canvas can use the
generator to look at the current
request for standard attributes
in the same way.

TEST PLAN:
  1) requests should keep on getting context ids
  2) sessions should keep getting added to the cookie jar

Change-Id: I9245491f722ac29c9544623ee14e0771ae248cd4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259609
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-03-02 23:02:40 +00:00
Ethan Vizitei 676ab0a310 extract PageViewJwt from PageView
refs FOO-1648
flag=none
[fsc-propagate=false]

RequestContextGenerator depends on
the PageView model so that it can
extract these attributes.  Pull
that responsibility out into canvas_security
to de-circularize that dependency chain.

TEST PLAN:
  1) RequestContext page view token decoding
     does exactly what it does right now
  2) specs continue to pass

Change-Id: If9dfa923338f2b67490593771d58e9610f514923
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259613
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>
2021-03-02 22:01:22 +00:00
Ethan Vizitei 6816e36902 pull canvas::security out into a gem
refs FOO-1648
flag=none
[fsc-propagate=false]

move general module code to "gems"
along with specs.

Leave shim in canvas to avoid breaking
things while callsites get changed.

change some limited callsites
from Canvas::Security to CanvasSecurity
that were doing spec stubbing that required
at least one namespace change anyway

generate readme describing common use
cases.

TEST PLAN:
  1) security operations continue unimpeded.

Change-Id: Ia2d102d5038e2f5d0bb24201e38894e12b73063e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259540
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-03-02 20:58:55 +00:00
Ethan Vizitei dafe965de0 extract canvas::redis to canvas_cache
refs FOO-1636
flag=none
[fsc-propagate=false]

- add gem initializer to canvas for canvas_cache
- move Canvas::Redis into canvas_cache
- alias module in canvas
- expand dependencies of canvas_cache
- add redis dependency to vendored gem environment
- extract RedisConnections to deal with disconnect/clear_idle

TEST PLAN:
  1) continue to cache things in redis
  2) caching behavior with canvas-extensions
     should not change

Change-Id: I96383eced80d670e14e535993f0c0608ab5f6520
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259434
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-03-02 14:38:55 +00:00
Ethan Vizitei 68487bf761 extract dynamic settings to it's own gem
refs FOO-1615
flag=none

first step of verifying modularization path for
chunks of behavior inside canvas.

take a dependency on config_file to minimize
unnecessary injection

move initialization of dynamic_settings to one place.
leave pointer in previous initializer file.

TEST PLAN:
  1) nothing changes at runtime
  2) dynamic settings specs can be run
     quickly on their own

Change-Id: I1bfbd5b8dfedb9835953d9fc663259c17b76ce7f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258762
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-03-01 19:18:01 +00:00
Ethan Vizitei 82f01c049b move hash_ring to the canvas_cache gem
refs FOO-1636
flag=none

canvas_cache stage 1
 - gem chassis
 - hash_ring port

TEST PLAN
  1) caching continues to work the same in operational environments

Change-Id: Ifd1d38b439b6bfaad640ccfb3c47fe761b1ed05d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259411
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2021-03-01 15:57:47 +00:00
Ethan Vizitei f9d4c85ce2 move database_builder to canvas_cassandra
refs FOO-1632
[fsc-propagate=false]

leave shim for plugins, but change
all in-repo callsites to gem version
of constant

TEST PLAN:
  1) nothing changes
  2) workloads talking to cassandra still converse with
     the correct databases.

Change-Id: I0ec6bbbee3a298762e6dce937f3b8cb690b474ad
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259318
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>
2021-02-25 15:19:20 +00:00
Ethan Vizitei cf33fba96c extract ConfigFile to gem
refs FOO-1627
flag=none

make Dockerfile cache use
gem instead

TEST PLAN:
  1) specs run successfully
  2) config in operational environments loads successfully
  3) reloading settings still causes config files to get
     re-parsed

Change-Id: I69bdfc2b79065600336f83c7ffb87dd8e647fa9c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259232
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-02-23 21:18:20 +00:00
Simon Williams 54b40993e6 i18n: fix typo in excluded key
refs FOO-1614
flag = none

test plan: `bundle exec rake i18n:generate` does not include any values
like `!ruby/object:Proc {}`

Change-Id: I5013f759f5274573e60264e6aa844fabff6a7ad6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259241
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-02-22 19:36:07 +00:00
Cody Cutrer 62fb86ea50 raise bundler minimum requirement
because of nokogiri, we rely on multi-platform gem caching, which
only works right in bundler 2.2

Change-Id: Id207278946e849abec3418807c71e4650506a0cf
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259142
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 22:49:02 +00:00
Manoel Quirino Neto 2ddd5db18d Remove Common Core top-level display in Find Outcomes
closes OUT-4197
flag=none

Test Plan
- Make sure you don't see Common Core in Find Outcomes

Change-Id: I47f3ab90cc136e7b7d2206dcadaadd297cc8915b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/257768
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: Pat Renner <prenner@instructure.com>
QA-Review: Augusto Callejas <acallejas@instructure.com>
Product-Review: Jody Sailor
2021-02-19 21:03:04 +00:00
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
Rob Orton bd66df9d0f spec: add some helpful comments to general spec
test plan
 - test should pass
 - this is just a comment in a spec file

refs: PFS-17385
flag=none

Change-Id: I7f058b5166cf1140b861a9bfc8ac6cf92202d697
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258959
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
2021-02-17 23:10:32 +00:00
Ahmad Amireh 5e4cd4ceb8 manually remove Proc translations in en.yml
refs FOO-1614
flag = none

this is a stop-gap measure to remove the two offending keys that are
present in en.yml and have a value of a Ruby Proc, the ideal fix would
be to tune the scanner to not pick up such phrases in the first place

test plan::

run "rake i18n:generate" and verify the translations file at
config/locales/generated/en.yml does not contain any value that starts
with `!ruby/`:

- en.number.nth.ordinals
- en.number.nth.ordinalize

Change-Id: Ia5edbdcd75617835b34c7634fd30a9ecc4866d83
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258906
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2021-02-17 18:38:08 +00:00
Cody Cutrer 160ff3c899 bump sanitize to latest
[fsc-max-nodes=12]
[fsc-timeout=60]

 * switch lots of parsing to Nokogumbo to keep things consistent
 * deep CSS sanitization is now built in, and with a proper parser (meaning
   we can drop our code to do it, and adjust some specs to account for things
   that _are_ valid)

lots of changes because gumbo parsing<->serialization cycle is slightly different:
 * better job preserving original whitespace
 * literal non-breaking space characters are converted to &nbsp; entities
 * <p> tags aren't inserted for the heck of it
 * several _other_ entities are unnecessary, and output as literal characters
 * some elements no longer have a closing tag

Change-Id: I7c5e36cbd04b8a05f64c9e0af00868dd6b00f4ce
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/256444
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-17 18:17:57 +00:00
Augusto Callejas 0068ab1f60 Use standard prefix enhanced number for outcomes
fixes OUT-4226

flag=none

test plan:
  - import New Brunswick Curriculum standards
  - confirm that the issue with standards with
    the same number as described in the Jira
    ticket doesn't occur anymore and that groups
    and outcomes at the bottom of the outcome
    hierarchy include fuller standard numbers than
    before

Change-Id: I4f70069f00edd3e93a6c08932355fc6ed10ef4ea
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258498
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Brian Watson <bwatson@instructure.com>
Reviewed-by: Pat Renner <prenner@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Jody Sailor
2021-02-12 18:57:23 +00:00
Cody Cutrer 362ca336e7 fix SimplyVersioned ccleanup in rails 6
also get rid of the separate connection nonsense

Change-Id: Ieb3645c677da5ee1bdc1d118dd673dfbbdd945fa
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258376
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-02-09 01:37:50 +00:00
Augusto Callejas af930016b7 Always include adopt year in document group name
closes OUT-4225

flag=none

test plan:
  - import several standards and confirm that
    document adoption years appear

Change-Id: Ic871f005c62190a17356cdda9609964b36084d0b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258056
Reviewed-by: Pat Renner <prenner@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Pat Renner <prenner@instructure.com>
Product-Review: Jody Sailor
2021-02-03 22:50:33 +00:00
Augusto Callejas 08e18fa9bf Update Academic Benchmarks API to v4.1
closes OUT-3985

flag=none

test plan:
  - if not already set up, configure the Academic Benchmarks
    Canvas plugin (see "Academic Benchmark Importing" Confluence
    document, but don't run the import there)
  - create an API token, both on your local instance and on
    a production environment, like beta (using your site admin account):
    Account > Settings > Approved Integrations > New Access Token
  - either set up the outcomes import tool
    ( https://github.com/FreedomBen/outcomes-import-tool )
    or use a tool like Postman to make REST calls
  - list available authorities (in Postman,
    GET /api/v1/global/outcomes_import/available)
    and compare local versus beta. Local has a more comprehensive list
    and fuller authority names
  - select similar authorities in both environments and request an
    import (in Postman, POST /api/v1/global/outcomes_import with
    "guid" value) locally and in beta
  - check the migration status of each (in Postman,
    GET /api/v1/global/outcomes_import/migration_status/<id>)
  - when both completed, compare them in Canvas:
    account outcomes page > Find

Change-Id: Ifaec4807ac9e5b8a50b87a098e7e9c79c30c1ea0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/257142
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Pat Renner <prenner@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
QA-Review: Pat Renner <prenner@instructure.com>
Product-Review: Jody Sailor
2021-02-02 18:43:17 +00:00
Ethan Knapp f6251a8867 make loading of AccountReports more dynamic
this allows parameters to be defined in the report class itself,
but still allows lazy loading of the report class

Test Plan:
  1. Validate that Report Types can be queried via the API
    (/api/v1/accounts/self/reports/) and that their documented
    parameters are returned
  2. Validate that a non-parallel report can be run
    (eg Active Enrollments Count Report)
  3. Validate that a parallel report can be run
    (eg Proserv Student Submissions)

flag = none
refs PFS-17181

Change-Id: I5e07f6c2088d4f6379f305e46d68144b81d3bb47
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/256781
QA-Review: Aiona Rae Hernandez <ahernandez@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mark Valentine <mvalentine@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Bryce Stevenson <bstevenson@instructure.com>
2021-01-27 21:32:20 +00:00