Commit Graph

32 Commits

Author SHA1 Message Date
Cody Cutrer c32d30f662 bundle update rubocop
[skip-stages=Flakey]
[skip-crystalball]

and apply corrections from new/updated cops:

 * Layout
 * Lint/AmbiguousRange
 * Lint/RedundantSafeNavigation
 * Style/HashEachMethods
 * Style/HashSyntax
 * Style/InverseMethods
 * Style/RedundantLineContinuation
 * Style/RedundantParentheses
 * Style/RedundantReturn
 * Style/SuperWithArgsParentheses
 * Style/SymbolProc

Change-Id: I787e46f5b1c89e0fedebd5452ba74567d66954c1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/334291
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Build-Review: Aaron Ogata <aogata@instructure.com>
Migration-Review: Aaron Ogata <aogata@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-12-06 14:25:02 +00:00
Cody Cutrer 502aa068da rubocop: Layout/Multiline*LineBreaks
[skip-stages=Flakey]

Change-Id: I24912809267088bc19a4082c49bc5f78ca7b76bb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/317302
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Build-Review: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-05-01 19:31:42 +00:00
Cody Cutrer f46fef5599 rubocop: Style/MapToHash, Style/MapToSet
Change-Id: I75a78a3d86d5875b450d4f32c2f71d8a44a735f4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/315125
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-04-11 14:41:55 +00:00
Aaron Ogata e9b7314ade fix known_users function signature
refs AE-92

Change-Id: I4d31a35831d62fb423228e38956bdd04f39a1195
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/307327
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2022-12-13 19:17:59 +00:00
Cody Cutrer c2cba46851 RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation
[skip-stages=Flakey]

auto-corrected

Change-Id: I4a0145abfd50f126669b20f3deaeae8377bac24d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279535
Tested-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-11-25 14:03:06 +00:00
Cody Cutrer e73cf9ddf4 RuboCop: Style/HashSyntax
[skip-stages=Flakey]

auto-corrected

Change-Id: I9371a61046aee6b148f89dd434114a8ba2b1188c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279533
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-11-25 14:02:35 +00:00
Cody Cutrer 9b71ed2054 RuboCop: Style/BlockDelimiters, Style/Lambda
[skip-stages=Flakey]

auto-corrected

Change-Id: I642f868d75c079e698f1fe4161bbbe419dbe1827
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279374
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>
Migration-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 21:30:47 +00:00
Cody Cutrer f5a4bfe1bc RuboCop: Style/InverseMethods
auto-corrected

Change-Id: Ic87dab4c152702c8804a623d6dc76337eac2114c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278768
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-11-18 21:37:28 +00:00
Cody Cutrer 80bce90260 RuboCop: Performance
[skip-stages=Flakey]

auto-corrected

Change-Id: I3c37291f9cc0d104b90c4a4e6023d6069954bc37
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278347
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-11-17 20:03:38 +00:00
Cody Cutrer 5970adfb0f RuboCop: Style/HashConversion
auto-corrected

Change-Id: Iac81f55bb4f8d58bde910d7aa4c98112df65f6a3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278497
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-11-17 15:17:51 +00:00
Cody Cutrer 58eb4175fb RuboCop: Performance/MapCompact
[skip-stages=Flakey]

auto-corrected

Change-Id: I9e768e051924cfe58bf282f85d3cf6ca48735e9d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278264
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-11-16 16:20:07 +00:00
Cody Cutrer 3512a9557e RuboCop: Style/SafeNavigation
[skip-stages=Flakey]

auto-corrected

Change-Id: I0a907a6fa6229f05b4f756faf53a8dd2b18ea0c5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278213
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-11-16 06:36:38 +00:00
Cody Cutrer a690e90aa8 RuboCop: Style/RedundantReturn
[skip-stages=Flakey]

auto-corrected

Change-Id: Ic472ca1cc04423fc966cd4a1ead467604d2904fc
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278130
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-11-12 16:33:45 +00:00
Cody Cutrer 1ccd29b412 RuboCop: Style/PreferredHashMethods
[skip-stages=Flakey]

auto-corrected for the most part, but I went through specs and used
the have_key matcher when possible

Change-Id: I4a2df1cdd536a94f3b493668386883d1148660c9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278050
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-11-12 16:24:14 +00:00
Cody Cutrer 7e7bc924b7 RuboCop: Lint/MissingSuper
all manual

Change-Id: Ibc71a5265c81359925c7819ea694f3cb7cc3e542
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277540
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-11-08 14:15:35 +00:00
Cody Cutrer 61e5b3a6dc RuboCop: Lint/UnusedMethodArgument lib
all manual

Change-Id: I0db0dbf9ffec3ac6675f6d159f8d038fe2f09256
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276489
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-10-27 15:54:27 +00:00
Cody Cutrer c65d57737a RuboCop: Layout lib
Change-Id: I0655d9a9d750f2debd6378b03d8ddc1403ebc31b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274158
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-09-22 20:01:52 +00:00
Ethan Vizitei a9d9da13ad downgrade several expected error locations
refs FOO-1125
flag=non

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

Change-Id: I6e97c04e3f6fcc3545b10418511934c89f20a419
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251536
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-10-30 16:46:01 +00:00
Cody Cutrer 06763dd519 add # frozen_string_literal: true for lib
Change-Id: I59b751cac52367a89e03f572477f0cf1d607b405
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251155
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-10-27 20:49:50 +00:00
August Thornton 3f6686e042 include admin_context on calls to address book user counts
fixes USERS-539
flag = none

test plan:
 - As an admin not enrolled in the course
   - Navigate to the People page
   - Have two different course sections with enrollments
   - Click the hamburger menu for a user and select
     the 'edit sections' option
   - Search for the section for which the user is not enrolled
   - Verify it returns the proper Section enrollment count
     that is non zero

Change-Id: Ib4e910878651fb80a450258237e43c56138dd528
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239597
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: August Thornton <august@instructure.com>
2020-06-10 16:49:07 +00:00
Davis Hyer 8d84255a3a allow siteadmin users to create conversations with all users
refs USERS-430
flag=none

test plan:
  - tests pass
  -- OR --
  - create a siteadmin user with a token
  - use the token to create a conversation
    - ie POST http://localhost:3000/api/v1/conversations
    - all recipients should be users you have no association with

qa risk: low

Change-Id: Id54eac5901ea59f281f08ebbc4d0b58d72f36266
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/231216
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Daniel Lee <dlee@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Davis Hyer <dhyer@instructure.com>
2020-03-25 19:13:22 +00:00
Michelle Simmons 0e3f7f6630 allow sending messages to group members from other sections
fixes COMMS-1308

When students are restricted to viewing only members of their own
section, and a group contains students from different sections,
students cannot send a message in Conversations to their group
members in a different section when the class is selected as the
context rather than the group itself. This commit allows students
to send a message to a group member in a different section when a
class is selected as a context.

Test Plan:
* Create a course with two sections; select the option that
  prevents students from communicating with students in a section
  other than their own.
* Create a group that contains students from both sections.
* Masquerade as a student that belongs to the group; compose a
  message in Conversations. In the "course" form, choose the course
  that you just created. In the "To" form, click on the address
  book icon; select Groups; select the group that the student
  belongs to; and select a student in the group that belongs to a
  different section than the student you're masquerading as
* Fill in subject & content; send the message
* The message should send with no errors

Change-Id: I0c0ab55d37b2c01d9dfa3a71d1f8940e565df600
Reviewed-on: https://gerrit.instructure.com/200187
Tested-by: Jenkins
Reviewed-by: Ryan Norton <rnorton@instructure.com>
QA-Review: Ryan Norton <rnorton@instructure.com>
Product-Review: Michelle Simmons <misimmons@instructure.com>
2019-07-18 22:00:38 +00:00
Jonathan Featherstone b5314abca5 Fix blank conversation_id param for conversations
Fixes issue with address-book "performance tap" plugin setting.

Test Plan:
  * Navigate to "/plugins/address_book"
  * Select "AddressBook performance tap" from "Answer address book
    queries through" option and click "apply"
  * Navigate to Inbox and compose new message
  * Message should send without issue (previously gave "unexpected error
    ID: ###" message)

closes CNVS-38284

Change-Id: I12d5dd50f716128d44599993152a4bf91e78555d
Reviewed-on: https://gerrit.instructure.com/119752
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jonathan Featherstone <jfeatherstone@instructure.com>
2017-10-03 16:59:17 +00:00
Jacob Fugal bdca4ebe60 count_in_contexts instead of count_in_context
refs CNVS-37900

with the old MessageableUser implementation, the behavior is identical.
but when using the service, it allows using one HTTP request against the
service's new /recipients/counts endpoint instead of multiple HTTP
requests against the deprecated /recipients/count endpoint

test-plan:
- enable the address-book service
- a query that involves multiple contexts in the result still gets
  counts for each of those contexts
- said query is faster, making one request for counts to the service
  instead of one each

Change-Id: I2793984f00247b3af3ebb8ba9ab559b38889c045
Reviewed-on: https://gerrit.instructure.com/117677
Tested-by: Jenkins
Reviewed-by: Andrew Huff <ahuff@instructure.com>
QA-Review: Jonathan Featherstone <jfeatherstone@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jonathan Featherstone <jfeatherstone@instructure.com>
2017-07-07 16:52:00 +00:00
Landon Wilkins 014cc7368c da licença part 25
add consistent license headers to all source files
(ruby, coffeescript, javascript)

except for vendor files

Change-Id: Ic87c252aa2a2e2739d61ee9164431698e8d7e547
Reviewed-on: https://gerrit.instructure.com/110048
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-04-27 21:51:40 +00:00
Jacob Fugal 547ca9f669 don't ignore address_book cache
don't need to preload users that are already in the cache. not
functionality change, just performance

test-plan: N/A

Change-Id: I34aecd97a35619718a7c66c902974d3b2cec09ae
Reviewed-on: https://gerrit.instructure.com/109287
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
Tested-by: Jenkins
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2017-04-20 22:16:50 +00:00
Jacob Fugal cd7462507b unify admin view handling in address book
fixes CNVS-35217, CNVS-35799, CNVS-35800

- allow Services::AddressBook.known_in_context to take a whitelist of
  user_ids. enables...

- allow address_book.known_users to take a context parameter (replaces
  include_context; see note below). enables...

- use known_users(users, context: ...) when normalizing recipients in
  the conversations controller, in place of post-filtering results from
  known_in_context(context, maybe_admin).

- remove is_admin flag from address_book.known_in_context; admin view
  never utilized for this method

- also remove is_admin flag from address_book.search_users; admin view
  is determined implicitly when context parameter present

- move admin_context checks from conversations controller and search
  controller inside the address book

- don't apply read_as_admin check when evaluating params[:context] for
  visible contexts in search results (it wasn't intended for that, only
  for @admin_context, which is gone)

- finally, make passing of contexts consistent; all of known_users,
  known_in_context, and search_users allow asset_strings _or_ context
  objects

note on include_context: include_context was intended to force inclusion
of participants in an otherwise unconnected context for an externally
vetted admin, without restricting other contexts. the context parameter
is instead intended to restrict to participants known either through
that context, or as an admin over that context while other contexts are
ignored. this is more consistent with how the call was being used.
meanwhile, whether an admin view is appropriate for that context is
determined within the address book instead of by the caller.

when determining whether a context is eligible for admin view within
known_users or search_users, the sender must have read_as_admin
permission on the context _and_ not be a participant in the context's
course (if any). this allows restrictions due to the course
participation to override read_as_admin, as they should.

test-plan:
[CNVS-35217]
- have an account with an account admin
- have a course in that account with two teachers (one section-limited,
  one not), and a student in a different section than the
  section-limited teacher (all active, published, etc.)
- ingest the data into the address book service and configure canvas to
  use the service
- as the account admin, search for the student in the inbox in the
  context of the course; should find them.
- as the non-section-limited teacher, search for the student in the
  inbox in the context of the course; should find them.
- as the section-limited teacher, search for the student in the inbox in
  the context of the course; should not find them.

[CNVS-35799, CNVS-35800]
- add two more students to the same course, then remove one from the
  course and deactivate the other
- re-ingest the data into the address book service (or have had the
  kinesis stream hooked up during the change)
- as the non-section-limited teacher, search for the student that was
  added but then removed; should not find them
- as the non-section-limited teacher, search for the student that was
  deactivated; should not find them
- as the account admin, search for the student that was deactivated;
  should not find them

Change-Id: I3233d8d45394c9233adc9888bfaf477e73bfde11
Reviewed-on: https://gerrit.instructure.com/107053
Tested-by: Jenkins
Reviewed-by: Andrew Huff <ahuff@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2017-04-20 19:47:07 +00:00
Jacob Fugal f4f97b8d91 add addressbook performance tap option
closes CNVS-34528

another option for the address book strategy chosen in the plugin.
combines answers from current MessageableUser implementation with
traffic directed to the service as if it were in use. but the service is
instructed via `ignore_result` parameter to reply to canvas as quickly
as possible, so that if the service does have performance issues, actual
canvas performance is not affected.

test-plan:
- set up canvas to be able to talk to the address book service
- have a published course with an active teacher and an active student
- do _not_ replicate that data into the address book service; i.e. the
  service answer should be wrong if used
- choose the "AddressBook performance tap" as the address book
  implementation in the plugin setting
- logged in as the teacher, query for the student in the inbox. should
  find the student (backed by the messageableuser implementation)
- check the service request logs; even though the service response
  wasn't used, there should still be a request made against it
- take down the service entirely
- repeat the query in the inbox. should still get the result from the
  messageableuser implementation despite the service being unavailable

Change-Id: I031b7c397d2e20d74d7699a81ca8040064a8df75
Reviewed-on: https://gerrit.instructure.com/104112
Reviewed-by: Andrew Huff <ahuff@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2017-03-13 17:11:02 +00:00
Jacob Fugal 26db7f1806 adopt pagination for address-book service
closes CNVS-34484

address-book service recently updated with pagination info available. in
the process, the shape of its response also changed. update for that
change in shape, and capture the pagination info it returns into the
bookmarker so it can be used for pagination here on canvas' end.

test-plan:
- have a published course with a teacher and >10 students
- have the address-book service running, your canvas configured to use
  it, and your canvas' data ingested into the service
- as the teacher, got to conversations and start a new message
- in the recipients field, open the address book and drill into that
  course's students
- should see all the course students (page traversal is happening
  transparently)
- should see multiple requests in the address book service's logs

Change-Id: I665ac77d01d93e74ac41f6291b4dc698c0446429
Reviewed-on: https://gerrit.instructure.com/100273
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Tested-by: Jenkins
Product-Review: Jacob Fugal <jacob@instructure.com>
2017-01-27 21:06:54 +00:00
Jacob Fugal 7e9a0bc16c implementation using address book service
closes CNVS-29869
refs CNVS-31303

adds an implementation of the AddressBook facade backed by an external
address book service. cleans up some implementation of the facade to
faciliate that.

intentionally punts on pagination through the service for right now.
that will be covered in a later commit addressing CNVS-31303.

test-plan:
 - depends on having an address-book service that fulfills the expected
   contract
 - if using consul, add the host for your address-book service to
   config/consul.yml (see config/consul.yml.example)
 - if not using consul, add it to config/dynamic_settings.yml (see
   config/dynamic_settings.yml.example)
 - go to your canvas' /plugins/address-book and configure your account
   to use the service implementation
 - smoke test the inbox address book UI in canvas

Change-Id: I4e89bd7c2ac64b5a4902905cbdd37c8283f7adf5
Reviewed-on: https://gerrit.instructure.com/88431
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2016-09-06 18:05:21 +00:00
Jacob Fugal b4c4f4fe3c plugin setting for address book strategy
closes CNVS-29825

test-plan:
 - before enabling plugin setting, address book should function normally
   (via MessageableUser)
 - enabling plugin setting and explicitly choosing MessageableUser
   strategy should allow address book to function normally
 - enabling plugin setting and explicitly choosing Empty strategy should
   not produce any page errors, but should cause all users to have an
   empty address book (don't actually create any conversations in this
   state or you'll end up with have zero-participant conversations)
 - re-disabling plugin setting should cause address book to function
   normally through MessageableUser again

Change-Id: I45848fd51bccef4d4a3d8d6ddad85b7c54582aa2
Reviewed-on: https://gerrit.instructure.com/87164
Tested-by: Jenkins
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2016-08-15 17:04:34 +00:00
Jacob Fugal 9a077a7873 AddressBook facade
fixes CNVS-29824
refs CNVS-29862, CNVS-29867

test-plan:
  check for regressions around:

  * accessing profile#show endpoint, with profiles enabled, is
    authorized if and only if current user knows profile owner.

  * eportfolios#show, with profiles enabled, includes link to owner's
    profile if and only if current user knows owner.

  * conversations:
    - filtering of individual recipients when creating a conversation
    - expansion of context recipients when creating a conversation
    - restriction of individual recipients to those known via course
      when creating a conversation in a course
      - including as an admin over that course
    - filtering of individual recipients when adding a message to an
      existing conversation allows existing recipients

  * searching/browsing address book (conversation creation, link
    observer to students, due date overrides, etc.):
    - when loading info about single user (user_id parameter), including
      combinations of conversation_id and context parameters, returns
      user data if and only if the target is known to current user under
      those parameters
    - users matched:
      - excludes already listed users
      - restricts to users known via specified context, if any
        - including as an admin over that context
      - finds users with weak associations (e.g. invited student that
        hasn't logged in for first time yet) when linking observers
      - doesn't find users with weak associations otherwise
    - contexts matched:
      - limited to those known to current user
      - have count of known users
      - have counts of known users in synthetic contexts

  * data returned for known users in various API calls include common
    course and groups between current user and returned user

Change-Id: I66bca0921b298be8d529a713fa982a6dfdcbcc8e
Reviewed-on: https://gerrit.instructure.com/84045
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2016-08-15 15:03:56 +00:00