Commit Graph

8795 Commits

Author SHA1 Message Date
Ethan Vizitei 0e98ac9bb6 FF Auditor errors should be raised
CLOSES FOO-2233
flag=none

TEST PLAN:
  1) destroy partitions for auditors
  2) try to write a FF update
  3) error gets raised obviously

Change-Id: Id9b40b54c84b77548f1f17724972b027c679d960
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270604
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-08-03 16:59:57 +00:00
Cody Cutrer b9ba940872 change permissions cache key
we changed the structure of this cache, so prevent pollution when running
concurrently with older processes

Change-Id: Idcc7578b1a102e2d850af0069f6543915de5ee68
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270610
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-08-03 16:09:51 +00:00
Jeremy Stanley b5f192db1e relative-ize canvas links outside the course in imports
background information:
----------------------

if you make an API PUT to

 https://example.instructure.com/courses/123/pages/foo

and include links to e.g.

 https://example.instructure.com/courses/456

canvas will rewrite the link in process_incoming_html_content
to look like

 /courses/456

which helps in being able to serve the content from multiple
domains (including, for example, cross-listed courses or
vanity URLs).

when exporting this content, canvas plugs in the primary
account domain to make the link absolute. this is necessary
because the package may be imported into a different domain.

the problem:
-----------

on import, these absolute links are left alone. if the content
is viewed on a secondary domain, the links will appear to be
to external content and navigation will be impeded (the user
may need to log in again, etc.)

test plan:
---------

1. have a canvas + multiple_root_accounts installation, with
   multiple AccountDomains for a single root account. we will
   call these A and B.
2. create two courses under this account, C1 and C2.
3. from domain B, create a page in C1 that links to C2
   (e.g. http://domain-b.local/courses/2)
4. notice in the HTML for the page (as viewed in the Rails console)
   that the link is actually to /courses/2 (at least, it should be;
   this PS hasn't changed this part)
5. export the course
6. import into a new course
7. ensure in the Rails console that the imported content
   also looks like /courses/2, with no domain attached
8. when the content is viewed through the web in domain B,
   the link appears to be in domain B and navigation is unimpeded

flag = none
fixes LS-2390

Change-Id: I767a7722baa06a00a9da46612bc2e1457485b98d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270541
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-08-03 01:19:19 +00:00
Ethan Vizitei dbbc61b0c3 don't fail to compact just because there are no root accounts
closes FOO-2229

TEST PLAN:
  1) decomission a shard (deactivate all accounts)
  2) run with pulsar reads/writes for aua
  3) flip back to db reads/writes
  4) compaction does not fail with invalid sql error

Change-Id: I788c7e00861b155266a9229c2c9fdffae8a46ae7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270526
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-08-02 20:40:46 +00:00
Cody Cutrer c506d3a2fe handle saml metadata that has only the public key
not the whole cert

fixes FOO-2182

Change-Id: Ia3b22bb336ef6b262e119d8dabe0a956afa05038
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270521
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-08-02 20:29:39 +00:00
Cody Cutrer c663830ced fix uncached reference
it's a class method, not instance method

Change-Id: I31891fd3990f01bdb69f609df21d8902972f62f9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270308
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>
2021-08-02 19:58:54 +00:00
Jorge Arteaga 935870097a prevent useless description conversion when importing to NQ
fixes QUIZ-8550
flag=none

test plan:
- create a classic quiz
- embed an image in the quiz description
- export the quiz as a QTI file
- import the quiz from the QTI file as NQ
- the import should generate a NQ
- open the NQ and see that it has instructions
with an image

- import the same QTI file with "import as new quiz" disabled
- the import should generate a classic quiz identical to
the original

Change-Id: I399698f367e016816475d51423b5d42ed5135da1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269449
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Susan Sorensen <susan.sorensen@instructure.com>
Reviewed-by: Jared Crystal <jcrystal@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
2021-08-02 13:28:38 +00:00
Rob Orton 73b24b14a1 use each now that there is a limit to ccs
this was now causing problems trying to modify a temple table record

test plan
 - specs should pass

fixes FOO-2222
flag=none

Change-Id: Ibed8c5dd7c56958c3fd970fa7bdfaa97d517a664
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270435
Reviewed-by: Chawn Neal <chawn.neal@instructure.com>
QA-Review: Chawn Neal <chawn.neal@instructure.com>
Product-Review: Chawn Neal <chawn.neal@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-07-31 04:37:28 +00:00
Rob Orton f71122eaed show defaults for non existent state for feature flag logging
test plan
 - specs should pass

refs VICE-1717
flag=all_flags

Change-Id: Ie83f953fbb9baca3a1d31541333191aa7ccde150
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270247
Reviewed-by: Drake Harper <drake.harper@instructure.com>
QA-Review: Drake Harper <drake.harper@instructure.com>
Product-Review: Drake Harper <drake.harper@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-07-30 18:35:39 +00:00
Cody Cutrer 98c0f21e87 use a lookup hash instead of iterating array for role override lookup
Change-Id: I4d019c04f984b07ce50517526f944eddc4535c8f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270396
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-07-30 17:55:02 +00:00
Cody Cutrer db153f2beb return a frozen account chain
so that we can return the same one every time if called multiple times
for the same context

Change-Id: I2c5825ab115c50d1332d05d1e3cecbe45cbe7ea1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270297
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-07-30 16:13:39 +00:00
Adrian Packel 0f694fdde8 Properly set hidden on bulk-update comments
When submitting comments via bulk update, check the posted status of the
submission instead of the muted status of the assignment when
determining whether the comment should be hidden. This fixes an issue
that could cause comments not to appear when the submission had already
been posted (or had just been posted, in the case of submitting both a
grade and a comment).

fixes EVAL-1815
flag=none

Test plan:
- Have a course with at least two students (you need at least two so
  that posting a submission for one student doesn't flip the
  assignment's "muted" status)
  - Take note of the ID of one of the students
- Create an assignment
  - Take note of the ID of the assignment
- Using a REST client or similar, send a POST request to the bulk update
  endpoint for the assignment (see below)
- As the student, open the submission details page
  - You should see both the grade and the comment

Sending the bulk update request:
- Send a POST request to the endpoint
  /api/v1/courses/<courseID>/assignments/<assignmentID>/submissions/update_grades

The content of the request should be multipart form data. The following
two lines will send both a grade and a comment to the endpoint for the
student whose ID is given by <student_id>:

grade_data[<student_id>][posted_grade]=5
grade_data[<student_id>][text_comment]=HELLO

Change-Id: Id3b97bf18ca888da2a2a04c372ff596335665f17
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269833
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Kai Bjorkman <kbjorkman@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
2021-07-30 15:21:46 +00:00
Evan Battaglia 0812089121 Remove useless teacherless? method & related code
* teacherless? method always returned false, and has since initial
  commit in 2011
* removed any code that depends on that being true, including a
  permissions grant (given/can) which was always false. (side note:
  'manage' and 'update' course permissions appear to be
  now identical.)
* RoleOverride.teacherless_permissions was only being used by that
  permissions grant
* After that, TeacherlessStudentEnrollment also then unused in code.
  * I have also verified there are no Enrollment records with
    TeacherlessStudentEnrollment anywhere in all shards on prod
* div.teacherless_invite_message was removed in 70bcc947cb, so I removed
  some Javascript that references it
* teacherless in JS_ENV apparently also unused
* side note: commits containing a certain commit can be found using e.g.
    git log -S 'TeacherlessStudentEnrollment' --oneline

Test plan:
- hard to test, so review very carefully
- grep through code for 'teacherless'
- try a couple things in the UI like having a teacher create a student
  just to make sure nothing is completely broken

flag=none
closes INTEROP-6954

Change-Id: Ibbbcacf64a87c29adc719b1d61f7b3e2241fc83e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270287
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-07-29 20:19:44 +00:00
Cody Cutrer 4d2e66383c use has_attribute? instead of attributes.key?
the latter has to allocate a new hash of all the attributes
everytime it's called

Change-Id: If21ffaf494b290f8cf6d52c35d5c7dddd9a7ad31
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270288
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-07-29 18:17:01 +00:00
Cody Cutrer d5b813bcf1 avoid allocating heavy AR objects for passing between internal RoleOverride methods
refs FOO-1019

Change-Id: I7fbc92f41e66a7e34c08ef4a86c0649070dfe068
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270295
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-07-29 18:16:18 +00:00
Mysti Lilla 6ca9a98660 Remove N+1s from membership service
fixes INTEROP-6859
flag=none

Test plan
- Run /api/lti/courses/:course_id/membership_service
  for a course with at least a few users set up
  and ensure that you don't get one SQL call each
  for pseudonym, enrollment and past_lti_ids
  for each user

Change-Id: I6819b68ada52d42e4fc14268059c5d8b83a42d3d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269599
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2021-07-29 18:06:55 +00:00
Jeff Largent 0935fd13d9 Add C4E subject banner image setting
Allows users with admin rights over K5 subject courses to set a
separate image on the settings page to be used on the home page of the
course. If no banner image is set, then the home page will use the
card image. If no card image is set, then the home page will use the
course color. If no course color is set, then a defauly blue-gray
color will be used.

closes LS-2351
flag = none

Test plan:
  - Create a new subject in a C4E account
  - Expect the home page to show the course name on a gray background
  - Go to the settings page and select a course color
  - Expect the home page to show the course name of background of the
    color you just selected
  - Go to the settings page and upload an image for the Card Image
  - Expect that image to show on the home page
  - Go to the settings page and upload an image for the Wide Banner
    Image
  - Expect that new image to show on the home page
  - Go back to the settings page, click the upper-right menu on the
    Wide Banner Image, and choose "choose image"
  - Expect the replaced banner image to show on the home page
  - Go back to the settings page, click the upper-right menu on the
    Wide Banner Image, and choose "remove image"
  - Expect the banner image to no longer show on the home page
  - Go to the settings page of a course in a non-C4E account and
    expect the Wide Banner Image setting to not appear

BONUS POINTS:
  - Set up Unsplash at /plugins/unsplash
  - Set a Wide Banner Image on a C4E subject via Unsplash
  - Make sure replacing / removing images works with Unsplash urls as
    well as uploaded ones

Change-Id: I24c162fb142c8d57760a52abd67e17dd0c30dd18
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269902
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
Reviewed-by: Jonathan Guardado <jonathan.guardado@instructure.com>
QA-Review: Jonathan Guardado <jonathan.guardado@instructure.com>
2021-07-29 16:28:16 +00:00
Rob Orton 0f4ebf4cfa treat all types as threaded for react_discussions_post
test plan
 - specs should pass

flag=react_discusssions_post
fixes VICE-1789

Change-Id: I7bbfd520007e941d2114c75fad88f73c377376d8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270234
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Matthew Lemon <mlemon@instructure.com>
QA-Review: Matthew Lemon <mlemon@instructure.com>
Product-Review: Matthew Lemon <mlemon@instructure.com>
2021-07-29 15:43:45 +00:00
Cody Cutrer 679e8d9201 fix ordering on a few conversions to ShardedBookmarkedCollection
didn't realize that helper method would return the raw relation as
an optimization, which if the relation doesn't have an order by on
it would be bad.

also fix the enrollments_api_spec to actually test bookmarks
and non-bookmarks, and simplify some of the logic in
EnrollmentsApiController#index both to clean up the code, and to
allow the specs to easily test both cases

Change-Id: Ifbaf588f787de7b54f3a26c6412cca81e2f34c4a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270186
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>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-07-29 04:14:24 +00:00
Rob Orton 3176418d6b set parent_entry_id and root_entry_id
test plan
 - reply to a discussion entry
 - it should properly set parent_entry_id
 - reply to the new entry
 - it should still set parent_entry_id

refs VICE-1779
flag=isolated_view

Change-Id: Ia633696165d8eb84960ebd446ff6dbeff4797983
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270224
Reviewed-by: Matthew Lemon <mlemon@instructure.com>
QA-Review: Matthew Lemon <mlemon@instructure.com>
Product-Review: Matthew Lemon <mlemon@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-07-29 03:59:51 +00:00
Ryan Hawkins d4d32fc449 MSFT Sync: Support new settings and refactor
Added support to the accounts update_api action for two new settings
related to Microsoft Sync.

The first setting, microsoft_sync_login_attribute_suffix is the
suffix that will be appended to the result of
microsoft_sync_login_attribute for the purposes of syncing.

The second setting, microsoft_sync_remote_attribute, is the Active
Directory attribute that will be used to associate Canvas users to
Microsoft users.

For example, if you had a login attribute of sis_user_id, a suffix of
@example.com and a remote attribute of mailNickname, then a query to
Microsoft would combine a user's SIS ID with the suffix, for a result of
12345@example.com and would then query Microsoft to look for any user's
who had a mailNickname that matched this new ULUV (User LookUp Value).

Note that the Selenium tests for the UI had to be taken out, as the
current UI doesn't work with this new backend. They will be readded and
adjusted in the next commit.

In addition, added support for a new login_attribute named
integration_id. This gives schools even more flexibility when
configuring MSFT Sync.

Lastly, moved all of the settings validation code out of a concern and
into a class, which explicitly defines what dependencies the validation
code has, and also just makes more sense in general.

closes INTEROP-6921

flag = microsoft_group_enrollments_syncing

test-plan:
* You'll be sending PUT requests to /api/v1/accounts/#{account.id} where
  the account.id is the id of the account you're using to test this. Use
  any tool you'd like for this, like cURL or Postman.
* The body of your requests will look like this in JSON:
  {
    "account": {
    "settings": {
      <the name of each of the parameters
      we're testing, such as
      microsoft_sync_remote_attribute>
      }
    }
  }
* Enable the microsoft_group_enrollments_syncing feature flag, either
  through the UI or a rails console with
  <account.root_account.enable_feature!(:microsoft_group_enrollments_syncing)>
* Send a request to the endpoint and set all of the fields to valid
  values. The name of each field is:
  	microsoft_sync_enabled
 	microsoft_sync_tenant
  	microsoft_sync_login_attribute
  	microsoft_sync_login_attribute_suffix
  	microsoft_sync_remote_attribute
  Enabled has to be a boolean, tenant has to be a valid domain name, the
  login attribute has to be one of (email preferred_username
  sis_user_id), the suffix can be anything under 255 characters without
  whitespace, and the remote attribute must be one of
  (userPrincipalName mail mailNickname)
  This request should succeed with a 200. Send a GET request to the same
  endpoint as above and ensure the settings have been saved.
* For each of the following requests, you should get a 400 with an error
  message and the account settings shouldn't change.
	* Send a request with a suffix over 255 characters.
	* Send a request with a suffix with whitepspace in it.
	* Send a request with an invalid remote attribute.
	* Send a request trying to enable sync, but without specifying
	  any settings. You can also mix it up and specify only a few
	  settings. Note that the suffix is optional, so if you only
	  omit that setting, you won't get an error.
* Send a request to the same endpoint, this time without authorization.
  It should fail with an auth required message.
* Turn the feature flag off and try and change some settings. You should
  get a message saying the feature flag is off.

Change-Id: If80f278e2294515be3e0b8dbf38dd22303e016b1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269542
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: Ryan Hawkins <ryan.hawkins@instructure.com>
2021-07-28 23:25:25 +00:00
Rob Orton 25fe44c5e3 fix class for reply_preview in editor
test plan
 - reply to a discussion entry
 - it should have the reply preview as an uneditable item in RCE

refs MAT-91
flag=isolated_view

Change-Id: Ib926bf794ccda2bcbb196dd520c33d01c9687e51
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270190
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Drake Harper <drake.harper@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Drake Harper <drake.harper@instructure.com>
Product-Review: Drake Harper <drake.harper@instructure.com>
2021-07-28 20:53:39 +00:00
Xander Moffatt b164a36618 allow public/nil visibility in external tool API
closes INTEROP-6676
flag=none

why:
* the API docs for external tools currently say that for the
course_navigation placement, setting visibility to null will allow
everyone to see the tool
* this is true, but once the visibility is set it can't currently be set
back to null
* for some reason (perhaps the public visibility option came after this
was first implemented), the tool will only save visibility if it's
admins or members, so allow setting it to public and kill two birds
with one stone
* also allow setting it to null/nil to remove the visibility constraint
entirely

test plan:
* in a Rails console, update a ContextExternalTool's visibility settings
for a placement like this:
```
tool.file_menu = {enabled: true, visibility: 'admins'}
```
* pick a placement that doesn't already exist so it's not overridden
* the reason we are using this method of updating (setting a placement
hash) is because the visibility validation only happens in this code
path
* save the tool and then examine `tool.file_menu`. it should have
visibility: admins
* set the visibility to public the same way
* save the tool and examine `tool.file_menu`. it should have
visibility: public
* set the visibility to `nil` the same way
* save the tool and examine `tool.file_menu`. it should not have any
config for visibility

Change-Id: Iaf0c4d51e3b90eea94a2d6b45df0c6d29f9ec939
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270175
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: Karl Lloyd <karl@instructure.com>
2021-07-28 18:51:51 +00:00
Xander Moffatt 8ac9f14b4c AGS: limit submission attempts for most types
why:
* the AGS did not previously respect the assignment's allowed attempts
* recent changes now respect attempt limits for the online_url,
online_text_entry, and basic_lti_launch types, since these types all
funnel through assignment.submit_homework
* desired behavior is to respect attempt limits but still allow
existing submissions to be updated
* only the default submission type, external_tool, needs to be accounted
for
* note that since content_items get uploaded in a job, that the attempt
limit check won't fail this request. so manually check it and fail if
needed

closes INTEROP-6730
flag=none

todo:
* replace all instances of new_submission with submitted_at presence

test plan:
* follow the instructions in doc/lti_manual/11_testing.md to send AGS
requests
* create an assignment that has an attempt limit
* send repeated AGS requests with no submission_type override
or submitted_at override
* they should succeed while under the attempt limit, and fail once the
limit has been reached
* repeat with other submission_types
* including a submitted_at time should not fail, even if the submission
is already over the limit

Change-Id: I73e3768bcab645b5040b9f042ec40c6e9a200c54
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269309
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Ryan Hawkins <ryan.hawkins@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-07-28 17:48:00 +00:00
Evan Battaglia e45eedb53f MSFT Sync: Ignore fake enrollments in Partial Sync
Note that even previous to this if the job were enqueued the fake user's
username is a random hash and the SIS ID (?) and email are not present so
the user would never really get added. But it's a waste of time to kick
off a job.

Test plan:
- Have a course set up with sync
- Click "Student View" on the upper right corner of the page on the
  page for the course
- Check that there is now a StudentViewEnrollment
- Check that the PartialSyncChanges and Delayed::Job tables are
  unchanged and there is no job

closes INTEROP-6922
flag=microsoft_group_enrollments_syncing

Change-Id: I2e6ba915355a45875e3a24064ab01084eed650a7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269926
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ryan Hawkins <ryan.hawkins@instructure.com>
QA-Review: Ryan Hawkins <ryan.hawkins@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2021-07-28 17:41:33 +00:00
Mauricio Ribeiro 484b53b7bc add reply preview feature
closes VICE-1561
closes VICE-1565
closes VICE-1566

flag=none

test plan:
  - With isolated view flag enabled:
  navigate to a discussion;
  click reply to an entry
  RCE should open with the reply preview html inside
  type your reply, save it
  the message should be saved without any reply preview html
  the message should be rendered with the reply preview on top

qa risk: low

Change-Id: Ied0d857808d4615edc5798022385af8f8b3be31f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270104
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-07-27 23:26:48 +00:00
August Thornton 387161737a return maximum current_login_at of all relevant pseudonyms
For trust links sometimes we see users logging into another
institution that trusts their current for a particular
course enrollment. They may have an active pseudonym on their
home shard, but not on the trust shard. Instead of querying
on non-existent pseudonyms look at all relevant pseudonyms
regardless of shard

fixes FOO-2066
flag = none

test plan:
• Have at least a trust with two accounts
• Create a user in account A
• Attempt to use the last_login API for the user in account B
  • /api/v1/users/<global_id>/?include[]=last_login
• Verify no error occurs and you get a value for the
  "last_login" attribute in the JSON response

Change-Id: I8b19721abd18ba05a76c85502b8c88ec86b692d9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269439
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
2021-07-27 21:40:50 +00:00
Evan Battaglia e64cc7d846 MSFT sync: make all graceful cancel errors public
* changes GracefulCancelErrorMixin mixin to class GracefulCancelError.
  All graceful cancel errors should be public, because they are expected
  errors so should have a public, internationalized, message.
* a few things that had GracefulCancelErrorMixin were not PublicErrors.
  Since they now are, I added public_message to them.
* Not strictly related but I made BatchRequestFailed and
  BatchRequestThrottled PublicErrors.

refs INTEROP-6739
flag=microsoft_group_enrollments_syncing

Test plan:
- Try changing your tenant to something we don't have access to,
  like microsoft.onmicrosoft.com
- Sync and look at the course integration settings. You should see the
  nice error saying 'Application not authorized for tenant. Please make
  sure your admin has granted access for us to access your Microsoft
  tenant.'
- Check the MicrosoftSync::Group object, there should be a last_error
  but not a last_error_report_id (Graceful Cancel Errors don't create
  error reports).

Change-Id: I583e24d1c9b0f50177c32010cf39c2d853c84a2a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269418
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Sean Scally <sean.scally@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2021-07-27 20:55:06 +00:00
Gary Mei 50c3bb9675 fix folder content downloads for concluded users
fixes MAT-285
flag=none

This changes folder downloads to match files such that if a user had
permission to download a file, then downloading the folder would
include those files. The exception is with hidden folders, as hidden
files require a direct link to the content, and a hidden folder does
not expose an option to download from the UI anyway. Users will still
need to download files directly with the link rather than being able
to download an entire hidden folder directly.

Test Plan
- Create an unpublished folder with an unpublished file within.
- Create a folder with availability dates that have since passed,
  with a file within that contains the same restrictions.
- Create a folder that's hidden, with a file within that's also
  hidden.

- As a concluded teacher, attempt to download the files alone. Verify
  that they all download successfully.
- As a concluded teacher, attempt to download the folders. Verify
  that all the folders include their respective files.

- As a student, attempt to download the files alone. Verify that they
  cannot, with the exception of the hidden file (they need a direct
  link).
- As a student, attempt to download the folders. Verify that they
  cannot.

Change-Id: Ia98e65be8672fa4a6b574cf6131ae20ecb3383d6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269270
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: David Lyons <lyons@instructure.com>
2021-07-27 19:58:22 +00:00
Rob Orton a327545168 extract prior state to methods
test plan
 - existing specs should pass

refs VICE-1717
flag=all_of_them

Change-Id: Id8f8670a96bae20898d4ebff0243387d9882e02e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270040
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Omar Soto-Fortuño <omar.soto@instructure.com>
QA-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
2021-07-27 19:10:43 +00:00
Ethan Vizitei dde25f0ffb async pulsar message producer
refs FOO-2198
flag=none

update AUA log compaction specs
to allow threaded queue to drain

TEST PLAN:
  1) be sending messages over pulsar in AUA
  2) cause some timeouts somehow
  3) pulsar messages back up in memory
     but canvas requests don't slow down.

Change-Id: I311f9d30699d6d07a58a80065a0d939472a2178e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269906
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-07-26 17:50:08 +00:00
Mauricio Ribeiro 4058f9b333 remove reply preview html from message on save
closes VICE-1563
flag=none

test plan:
  - For now, run the spec
    spec/models/discussion_entry_spec.rb:119
  - Or create a DiscussuinEntry on console,
  containing this node opn message:
  "<div data-discussion-reply-preview='1'></div>Left me"
  - After save only "Left me" shouyld be persisted
  - the flag include_reply_preview should be
  setted as true

qa risk: low

Change-Id: I2ec2304c8a7b9c1ff9eea2a572e899f10a7f2e77
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269907
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-07-26 15:16:31 +00:00
Cody Cutrer c7cd9d3248 ensure deleted users can't login
refs FOO-2039

Change-Id: I64a41f5695feb913bde03676683d8e5afd8dea3f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269786
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-07-23 22:41:48 +00:00
Adrian Packel f7c49c6fc9 Validate submission type on non-API submissions
When a student submits an assignment via the web interface, make sure
that the assignment actually accepts the submitted type. In most cases
this isn't an issue because you're only allowed to select from the types
the assignment accept, but it could become one if the assignment changed
types while a student was midway through submitting, or if someone was
trying to do something sneaky.

Note that this specifically applies to the current student view--not the
enhanced view--and does not affect submissions made via API (for which
we already checked the type).

fixes EVAL-1749
flag=none

Test plan:
- Have a course that is *not* using the enhanced student view
- As a teacher, create an assignment that only accepts a certain
  submission type (e.g., text entries)
- As a student in a different browser, open the assignment and begin a
  submission, but do not actually submit
- As a teacher, update the assignment and change the allowed submission
  type to someting else (e.g., URLs)
- As a student, try submitting the assignment with the original type
- You should get an error
- Smoke test submitting to assignments with the *correct* type and
  ensure there are no errors for the following types:
  - Text entries
  - File uploads
  - An LTI submission (e.g., Studio)

Change-Id: I50ba59afd94996d60cc8275e2ff7f73ddeb03c3c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/267717
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
QA-Review: Syed Hussain <shussain@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
Reviewed-by: Kai Bjorkman <kbjorkman@instructure.com>
2021-07-23 17:49:38 +00:00
Ethan Vizitei 5efe90b0fa handle a few more maintenance cases for pulsar broker rotation
refs FOO-2190

TEST PLAN:
  1) run pulsar AUA log compation
  2) reboot pulsar brokers
  3) we don't get big error spikes

Change-Id: I33062f06242f5189a8c454cbaa55b471925c97ed
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269645
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-07-22 14:24:09 +00:00
Caleb Guanzon d7d8337799 add update_topic to discussion_entry model create
fixes VICE-1453
flag=react_discussions_post

test plan:
- with feature flag OFF
- add a reply to a discussion
- visit discussion index page
- verify that Last post at reflects the date when you
   saved your newest reply

- repeat the test with feature flag on

todo: specs
Change-Id: Ieb1a191cf6cc21012dbb726ea1cb17ebf5e18403
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269662
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-07-22 13:39:46 +00:00
Jackson Howe e9394e0c3f Clear k5 cache from job on setting change
It takes too long to do this serially when the setting is updated,
so do it from a job after the setting is toggled.

refs LS-2405
flag = none

Test plan:
 - As an admin, open account settings and turn on or off k5 mode
 - Go to the dashboard and expect to see the correct dashboard
 - Flip the setting again and expect the dashboard to update (within
   a few moments)

Change-Id: I564164c4d680e23c415175b79154f1fab1ccba12
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269578
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: Jackson Howe <jackson.howe@instructure.com>
2021-07-21 21:13:14 +00:00
Chawn Neal e096df9562 Make Conferences more specific
Closes VICE-961
flag=none

TEST PLAN:
 Turn on BBB and Adobe Plugins individually and together.
 Go to a course and course nav should match design
 Go to a group and group nav should match design

Change-Id: I494337b40d9dc60199f6a2b1453e1fd0adada37b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269521
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2021-07-20 21:54:41 +00:00
Ethan Vizitei afd5bf1617 handle consumer side timeouts for pulsar reboots
refs FOO-2190

TEST PLAN:
  1) run pulsar AUA log compation
  2) reboot pulsar brokers
  3) we don't get big error spikes

Change-Id: I683410435308b2289de53ce4aa7440a3a3f90d33
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269570
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-07-20 21:02:23 +00:00
Ethan Vizitei 122c97fc1a handle pulsar timeouts during broker restarts
closes FOO-2190
flag=none

TEST PLAN
  0) be running messages through pulsar
  1) restart all the pulsar brokers
  2) timeout errors don't keep happening
     until the next fleet restart

Change-Id: Ia61406de49bf9ad62aa57dffa62a8c4a7e5d8278
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269552
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-07-20 20:14:12 +00:00
Cody Cutrer 931a7c6495 fix scope of ReleaseNote.reset! call
fixes FOO-2115

Change-Id: I07ce6161827c6e80e1c47adcd97ebb51c322561a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269549
Reviewed-by: Jacob Burroughs <jburroughs@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-07-20 20:00:44 +00:00
Cody Cutrer 9dca942297 clean up developer key account bindings
* use api_find in developer key account bindings controller
 * use workflow module instead of writing a bunch of stuff manually for the same
   concept
 * set some columns NOT NULL
 * collapse a hand-written query that actually takes two queries into
   using Rails relations and only one
 * take out a condition in that query entirely, instead of making a non-sensical
   comparison

Change-Id: Ifdf88a6c398c1d6353ec273712383bbd3c9c7907
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269133
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-07-20 16:52:48 +00:00
Evan Battaglia a47288b7ea Sync: Lookup MSFT users via suffix & remote attr.
Some of our customers don't have their Microsoft accounts set up such
that the UPN (UserPrincipalName) of Microsoft users is exactly equal to
the username, SIS id, or email of the corresponding Canvas user. So,
they need another way to link Canvas users and Microsoft users. This
to the (Canvas username | SIS id | email) and then using that to match
commit makes the linking more flexible by allowing a suffix to be added
to different fields (mail or mailNickname) instead of always matching to
the UPN.

closes INTEROP-6739
flag=microsoft_group_enrollments_syncing

Test plan:
- NOTE: this is the test plan I followed, but it is quite complicated.
  You can use the users I already created on our Microsoft test tenant, or you
  might want to test a few simpler scenarios.
- in our Microsoft tenant set up new users with emails, mailNicknames,
  and UPNs that are all new and completely different from each other.
  The easiest way is to create users in the admin console (add a license
  which allows them to have an email address) then use
  https://developer.microsoft.com/en-us/graph/graph-explorer and the
  PATCH /v1.0/users/...aadid... endpoint to set the properties using
  JSON blobs for each, e.g.:
    {
      "displayName": "INTEROP User 1",
      "userPrincipalName": "INTEROPabc@OURTESTTENANT.onmicrosoft.com",
      "mail": "ebattaglia.def@OURTESTTENANT.onmicrosoft.com",
      "mailNickname":"INTEROPghi"
    }
    {
      "displayName": "INTEROP User 2",
      "userPrincipalName": "ebattaglia@OURTESTTENANT.onmicrosoft.com",
      "mail": "ebattaglia.mno@OURTESTTENANT.onmicrosoft.com",
      "mailNickname":"INTEROPpqr"
    }
    {
      "displayName": "INTEROP User 3",
      "userPrincipalName": "INTEROPstu@OURTESTTENANT.onmicrosoft.com",
      "mail": "ebattaglia1@OURTESTTENANT.onmicrosoft.com",
      "mailNickname":"ebattaglia1"
    }
- Make two courses, "course I" and "course II", and enable sync on them.
- Set up new Canvas users with SIS ids, emails, and usernames that are
  all completely differnt but that can be related to the UPNs, mails, and
  mailNicknames above in various ways, some with suffixes. e.g.:
    User A: username=INTEROPabc@OURTESTTENANT.onmicrosoft.com
            email=ebattaglia.mno@OURTESTTENANT.onmicrosoft.com
            SISid=INTEROPgh
    User B: username=ebattaglia.mno
            email=ebattaglia1@OURTESTTENANT.onmicrosoft.com
            SISid=INTEROPstu@OURTESTTENANT.onmicrosoft.com
    User C: username=ebattaglia1
            email=ebattaglia.def@OURTESTTENANT.onmicrosoft.com
            SISid=ebattaglia
    AlwaysATeacher1: username=interop_teacher
                     SISid=interop_teacher
                     email=interop_teacher@OURTESTTENANT.onmicrosoft.com
    AlwaysATeacher2: username=interop_student
                     SISid=interop_student
                     email=interop_student@OURTESTTENANT.onmicrosoft.com
    The last two are just to make sure there are always some teacher
    in each course (otherwise the sync will fail).
  This may be easiest to do by adding new users to a course and then
  editing their properties. I used
    User.update_all workflow_state: 'active'
    CommunicationChannel.update_all workflow_state: 'registered'
  To fix up pending states (NOTE that updates all your local users, so
  make sure you don't care about pending states for other users)
- Enroll:
    in Course I: User A as a teacher and user B as student
    in Course II: User B as a teacher and User C as student.
    in both: AlwaysATeacher1 and AlwaysATeacher2 as
  (For some reason looking up by username instead of email when adding
  user to a course worked better for me.)
- Change the root account settings to map the users in varying ways,
  e.g.
  c_i = Course.find(...)
  c_ii = Course.find(...)
  acct = c_i.root_account
  acct.settings[:microsoft_sync_login_attribute] = 'preferred_username'
  acct.settings[:microsoft_sync_login_attribute_suffix] = \
    '@OURTESTTENANT.onmicrosoft.com'`
  acct.settings[:microsoft_sync_remote_attribute] = 'mail'
  acct.save
- Clear user mappings:
    MicrosoftSync::UserMapping.delete_all
- Run syncs on both courses. Check in the Micrososft admin console that
  the expected users are left in the course in the proper roles.
    c_i.microsoft_sync_group.syncer_job.run_synchronously
    c_ii.microsoft_sync_group.syncer_job.run_synchronously
- Run for varying configuration of login_attribute, suffix,
  remote_attribute.
- Examples for above setups (ignoring 'always teachers' users)
  SIS id, username, and email on Canvas side as above)
  1) LA=preferred_username suffix="@OURTESTTENANT.onmicrosoft.com" RA=mail
     (User B maps to INTEROP User 2, User C maps to INTEROP User 3)
     => Course I: members=[INTEROP User 2]
        Course II: owners=[INTEROP User 2] members=[INTEROP User 2, INTEROP User 3]
  2) LA=email suffix= RA=mail
     => User A maps to INTEROP User 2, User B maps to INTEROP User 3, User C maps to INTEROP User 1
     => Course I: owners=[INTEROP User 2] members=[INTEROP User 2, INTEROP User 3]
        Course II: owners=[INTEROP User 3] members=[INTEROP User 1, INTEROP User 3]
  3) LA=sis_user_id suffix=i RA=mailNickname
     => User A maps to INTEROP User 1
     => Course I: owners=[INTEROP User 1] members=[INTEROP User 1] (no
        'always teachers' users)
     => Course II sync will fail because group doesn't have any owners.
       (it doesn't have any users at all that match on the Microsoft
       side actually)
  3) LA=sis_user_id suffix= RA=UPN
     (User B maps to INTEROP User 3)
     => Course I: members=[INTEROP User 3]
        Course II: owners=[INTEROP User 3] members=[INTEROP User 3]
  4) LA=sis_user_id suffix= RA=nil (default = UPN)
     Same as above
- Choose one of the above setups and run partial syncs by
  adding/removing users from one of the courses and checking that the
  users are added/removed correcly. Clear UserMappings before each
  partial sync run.

Change-Id: If10020393fe45ea44ac260da7d39fc8a1a87bf86
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269162
Reviewed-by: Ryan Hawkins <ryan.hawkins@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2021-07-19 23:12:38 +00:00
Evan Battaglia bbeb70cb19 MSFT sync rename UPN -> ULUV (User LookUp Values)
Currently, to find users on the Microsoft side, we take their email,
username, or SIS id and look up the Microsoft user with the UPN
(UserPrincipalName) equal to that value. Thus, we call that
email/username/SIS id a "UPN" in the code.

Now however we are moving to a model with the user can choose what
target attribute on the Microsoft side they wish to match that value
(email/username/SIS id) to. (Additionally, they will be able to add an
arbitrary suffix to the value on the Canvas side before using it to look
up the user on the Microsoft side). Thus, we need a new term for this
value that we are calling a "UPN". I propose the term ULUV, or User
LookUp Value.

The only thing this commit does is rename constants/classes/variables.

refs INTEROP-6739
flag=microsoft_group_enrollments_syncing

Test plan:
- specs. as I add functionality in the next commits we will test that
  the old functionality (looking up by UPN) still works.

Change-Id: I5898e9c0fd53c67c4f24dbf6166e67d68af8d9f3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269157
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ryan Hawkins <ryan.hawkins@instructure.com>
QA-Review: Ryan Hawkins <ryan.hawkins@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2021-07-19 23:12:09 +00:00
Han Yan ff2ea293f1 fix invalid regrade_option option
closes QO-743

flag=none

test plan:
- pass specs

Change-Id: Ifc2fc6d530b6fd5139065df6c4cb5a7c774fc5fd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/267638
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Product-Review: Mark McDermott <mmcdermott@instructure.com>
Reviewed-by: Stephen Kacsmark <skacsmark@instructure.com>
2021-07-19 21:44:14 +00:00
Manoel Quirino Neto 25b74134d5 Add 'source_learning_outcome_group_id' to course copy importers
closes OUT-4548
flag=improved_outcomes_management

Test plan:
  Step 1: Setup a course group with source_outcome_group_id present:
    You can do this in 2 differents way:
    * 1: In any course, grab a learning outcome group and set the
      "source_outcome_group_id" attribute.
      This id must be the group id of an account group.
    * 2: Or use the graphql import API to import a group from the account
      Follow instructions on g/259131, section "Import a whole
      group from account to course"
    * After you setup the group, let's say you setup the group called
      "group 1", grab the id of "group 1" and hold for now as GROUP_1_ID.
    * You can grab the id by using the web inspector and inspect the
      graphql request after selecting the group in the LHS

  Step 2: Export course content:
    * Go to course -> settings -> export course content
      Export type: course
    * Click "Create export"
    * Wait the export to finish and click in "New Export"

  Step 3: Verify exported content.
    * Go to finder and find the exported file, it should has the
    .imscc extension. Replace the extension to .zip and unzip it
    * Open the file course_settings -> learning_outcomes.xml
    * Assert it's populated some source_outcome_group_id nodes of
    learningOutcomeGroup node
    * rename it back to .imscc

  Step 4: Import the course content in a blank course at the same account.
    * Go to account -> "+ course"
    * Go to the new course -> settings
    * Import course content
      Content type: Canvas Course Export Package
      Source: the imscc file
      Content: All content
      Click "Import"
      Wait until its done

  Step 5: Assert import works properly
    * Go to course -> outcomes
      You should see same outcomes as the exported course
    * Grab the id of the "group 1" that was just imported, lets
      hold in IMPORTED_GROUP_1_ID.
    * Go to console:
      Assert the source_outcome_group_id of GROUP_1 is the same
      of IMPORTED_GROUP_1_ID
      Assert the source_outcome_group_id are present (not nil)
      LearningOutcomeGroup.find(GROUP_1_ID)
      LearningOutcomeGroup.find(IMPORTED_GROUP_1_ID)

  Step 6: Import the course content in a blank course IN A DIFFERENT
  account.
    * Same as step 4

  Step 7: Assert import works properly
    * Same as step 5, but now the source_outcome_group_id should
      not be populated, since its belongs to a different account.
      Check this behavior in console

  Step 8: Assert course copy also copy the source_outcome_group_id
    * go to settings in course you want to copy > copy this course
    * check in console like step 4

Change-Id: Iada96de5b614441d86cdab96644d6110d7e3fe58
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/268694
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: Pat Renner <prenner@instructure.com>
QA-Review: Martin Yosifov <martin.yosifov@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
2021-07-19 21:41:10 +00:00
Spencer Olson e90231f8a4 recompute grades when assignment anonymous_grading changes
closes EVAL-1813
flag=none

Test Plan:
1. Create and publish a course with a student and a teacher
2. Create an assignment with Anonymous Grading enabled
3. Submit to the assignment as the student.
4. As the teacher grade the submission.
5. Disable anonymous grading on the assignment.
6. Export the gradebook and notice the unposted assignment group total
   and unposted course total columns include the grade given.

Change-Id: I4dc6dec393d4120d71c69f85dce136448dc3e327
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269400
Reviewed-by: Jake Oeding <jake.oeding@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Jody Sailor
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-07-19 20:00:40 +00:00
Cody Cutrer 54de40a41a preload role overrides for roles API
also only build the overrides cache for the current permission we're
inspecting when in no-cache mode. and other reduce-allocations-optimizations

prevents massive dependence on the query cache and re-instantiating
hundreds-to-thousands of AR objects, and thousands-to-millions of
ruby objects

for a particularly bad case, this should take it from several minutes
to a second or two at most

fixes FOO-1019

Change-Id: I8837a8b5b179491d4f7b3805788b2e3c1db83a6d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/268495
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>
2021-07-19 19:59:28 +00:00
Xander Moffatt 19654cd760 set locale in lti_message_hint during LTI login
refs INTEROP-6862
flag=none

why:
- for the cookie relaunch gem mostly, so that it can have the
user's locale during the login request
- locale is already passed during the launch request

test plan:
- launch an LTI tool and intercept the login request using the Network
tab of the Developer Tools
- copy the lti_message_hint parameter, and paste it into jwt.io
- it should contain a  canvas_locale claim that contains your locale

Change-Id: Ic60d2d434d69a5bf86b86ec8a00c1e3d9f2dbf80
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/268836
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Ryan Hawkins <ryan.hawkins@instructure.com>
2021-07-19 16:19:32 +00:00
Cody Cutrer df9ab5725c wait for replication when clearing account downstream caches
refs FOO-2079

the queries that these caches protect are pretty critical, and often
run against the secondary, so make sure the secondary is up to date

Change-Id: Ia2e6ce9c45911eebf04630d1e4464d128980c1b8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269229
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-07-16 17:04:55 +00:00