Commit Graph

64 Commits

Author SHA1 Message Date
Cody Cutrer 9c48318a45 RuboCop: Rails/WhereEquals
auto-corrected, with post-review looking for cases where an unqualified
column would now be (incorrectly) qualified (only one found)

Change-Id: I62ef6d40ce9e7bc062db261d9c6fb9383ecd102e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278432
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-16 21:19:56 +00:00
Cody Cutrer 91e62f3c07 RuboCop: Performance/InefficientHashSearch
[skip-stages=Flakey]

auto-corrected

Change-Id: I6f0bcce771de76cc0b653507653681597c292a36
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278329
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:45:20 +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 fd6b50710c RuboCop: Style/CaseLikeIf
[skip-stages=Flakey]

auto-corrected

Change-Id: I1f6b8a5f58a97a3ef17004ba9bf7a0940632dd55
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278161
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 20:24:23 +00:00
Cody Cutrer bb9fe29416 RuboCop: Lint/IneffectiveAccessModifier
all manual

note that for any methods moved/re-indented, I made no other changes
(except possibly a remove of a `self.` on a method call to call another
now-private method) for ease of review

Change-Id: I0cca6644264a0b46a45a1a5c99021c9deb64fca0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277532
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 15:50:15 +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
Cody Cutrer 412e9f8ad3 more prep for root_account_id=0
refs FOO-1693

Change-Id: Ie12fc99703aa6aaebdff0828bf4aaa13179ef7c4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265810
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-05-26 17:34:48 +00:00
Simon Williams e99a87e229 fix account course/user search for bigint out of range
fixes FOO-1203
flag=none

test plan:
- account course and user search should still work
- searching for "9223372036854775808" should not error

Change-Id: I7bcc331d7fd6a77f00e0e326f7ef85bc1892f87b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/252812
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-11-16 20:27:53 +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
Cody Cutrer b4626f2bc7 use EXISTS subquery for filtering users by role in Account
closes USERS-388

flag = none

test plan:
 * /api/v1/accounts/50/users?enrollment_type=student should still work properly

Change-Id: I990f6abbeb1777d48313c7e203b1f02f0fc82e07
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/229621
QA-Review: August Thornton <august@instructure.com>
Product-Review: August Thornton <august@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Williams <jamesw@instructure.com>
2020-04-15 14:05:27 +00:00
Ben Nelson 4ba960d4aa add api parameter to exclude inactive group members
adding a new parameter so we don't break any existing
behavior

TEST PLAN:
- create a course with 2 student enrollments
- create a group and enroll both students in the group
- deactivate one of the student enrollments
- make a GET request to
    /api/v1/groups/:group_id/users?exclude_inactive=true
- see that the inactive student is not returned in the result

fixes KNO-18
flag=none

Change-Id: I6d424607b2a33de52aa6e4303874905dc1439d51
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/221142
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Matthew Lemon <mlemon@instructure.com>
QA-Review: Steven Burnett <sburnett@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2020-01-05 06:19:04 +00:00
Charley Kline 9eb61c58d2 Fix AR scoping issues in user_search by last_login
Fixes USERS-70
flag=none

The scopes in user_search didn't bring in all the
right columns out of the users table in order to
be able to properly include the last login info
from the corresponding pseudonyms. As a result, when
on the account people page, one would both have an
active search AND sort by the last_login field, the
last_login column would be nil, and all that data
would vanish out of the UI.

So we've got to explicitly bring in all the columns
(via users.*) for it to work. I also added a test in
case someone breaks this later... it's awfully subtle.

Test plan:
* Rerun the steps to reproduce in the ticket
* When limiting the users list via a search, you
  should be able to sort on the "last login" field
  and have that column not disappear and also sort
  properly (both ascending and descending)

Change-Id: Icd31bfab19e4e074f42ac1105904fcb11a0db10a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/217466
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Tested-by: Jenkins
Reviewed-by: Landon Gilbert-Bland <lbland@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Steve Shepherd <sshepherd@instructure.com>
2019-11-18 17:14:04 +00:00
Mysti Lilla 58e5f4ae2d Remove duplicate user entries from user search
fixes ADMIN-2844
flag=none

Test plan
- Follow repro steps in ticket
  and ensure you only get the user
  returned once

Change-Id: I3807ab2bfa6793a6a9d81524a4b42a2910c32cb5
Reviewed-on: https://gerrit.instructure.com/208018
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2019-09-04 21:13:20 +00:00
Mysti Lilla 0352326afa Scope account/course user search better
fixes ADMIN-751

Test plan
- Specs pass
- Do smoke test on account and course
  search functions

Change-Id: I2c7e32c32bc52c1a364ed40a89db0b7dc9557ffb
Reviewed-on: https://gerrit.instructure.com/200682
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2019-07-17 21:23:51 +00:00
Han Yan adb68bcfa4 allow user api to take enrollment_type parameter
closes QUIZ-6435

test plan:
- checkout the patch and spin up local Canvas
- verify the url:
  <your canvas>/api/v1/accounts/<account id>/users?enrollment_type=teacher
- it returns all valid teacher in the account (from all courses in
  the account)
- verify the url with search term:
  <your canvas>/api/v1/accounts/<account id>/users?enrollment_type=teacher&
    search_term=<search_string>
  (note search_string must have at least 3 characters)
- it returns valid teachers for the search term

Change-Id: I0f917e71d0b4baef97284541dbb82d7966675c6d
Reviewed-on: https://gerrit.instructure.com/193389
Tested-by: Jenkins
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Ben Nelson <bnelson@instructure.com>
Product-Review: Stephen Kacsmark <skacsmark@instructure.com>
2019-05-29 20:43:56 +00:00
James Williams 02c3da1a94 improve sorting on account users search page
test plan:
* sorting by email or sis id should still
 work more or less as before and perhaps slightly better

- email should actually use the communication channels
- sis user id should use the one for the current account
 if the user has multiple logins
- should work while filtering by role type

closes #CORE-1636 #CORE-1637 #CORE-1687

Change-Id: I2dcbc8ad1584d50642e31f30d1ac785ded647a04
Reviewed-on: https://gerrit.instructure.com/160163
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2018-09-10 19:02:11 +00:00
James Williams b639254de0 sort users not logged in last when sorting by last login
test plan:
* on the account user search page, when searching by
 login descending, it should put users without any
 login time last

closes #CORE-1688

Change-Id: I2c13c52d6ada64c31865944f4a1bb32ebc2625ad
Reviewed-on: https://gerrit.instructure.com/159807
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-08-16 14:52:42 +00:00
Jeremy Stanley 7bfe0ac4b6 fix user_search permissions
test plan:
 - enable the "Account Course and User Search" feature
 - ensure "See other users' primary email address"
   permission is required to find by email address
 - ensure "Read SIS data" or "Manage SIS data" is
   required to find by SIS ID
 - ensure "View login ids for users" is required
   to find by login ID
 - ensure you can find users by canvas ID and name
   in the same search (where one user's name matches
   another user's ID)

also:
 - ensure students cannot use the include[]=email
   option in the "List users in course" API to
   retrieve email addresses of other students
   (unless granted "See other users' primary
   email address" permission)

fixes ADMIN-836

Change-Id: I9c0a1ba9a643632047f42dc010822b6e5035d0d4
Reviewed-on: https://gerrit.instructure.com/143915
Reviewed-by: Mysti Sadler <mysti@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
Tested-by: Jenkins
2018-04-09 17:19:56 +00:00
James Williams b14891827d fix role filtering in new account user search
use the code that already exists for enrollment role filtering

test plan:
* shouldn't include deleted enrollments when filtering
 by role in the new account user serach

closes #ADMIN-869

Change-Id: I8d32f1a54ad6791ec91540e4e8725abfade791ce
Reviewed-on: https://gerrit.instructure.com/144019
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2018-04-07 00:44:54 +00:00
Rob Orton 1bd47da265 limit communication_channels to root_account
refs CORE-778

test plan
 - search for a user
 - it should work faster

Change-Id: I4f7010ff40ac2329215cc24c1a0af347ec359f74
Reviewed-on: https://gerrit.instructure.com/141602
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-02-22 22:02:34 +00:00
Rob Orton bb468b268c return sis_users when matching canvas_id in search
fixes CORE-778

test plan
 - search for a user with sis_id that matches a
   canvas_id
 - it should return both users

Change-Id: I3495decec057e57357d6104b0f935086a22f380b
Reviewed-on: https://gerrit.instructure.com/141599
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2018-02-22 21:50:46 +00:00
Mysti Sadler 32bb7196e8 Run user search query on the slave
Fixes ADMIN-687

Test plan
- In the course, load up the user's page
  and verify that you can search for a
  user without any issues
- In the logs, the queries that show should
  register as running on the slave instead
  of master
- Verify /api/v1/courses/:id/search_users
  works as expected

Change-Id: I013b666b12e90e9d4cd1978e6a61da805f91d0d3
Reviewed-on: https://gerrit.instructure.com/139979
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Mysti Sadler <mysti@instructure.com>
2018-02-12 19:08:48 +00:00
Cody Cutrer f3f5edd029 fix improved user search query
refs CNVS-39879

the additional (unnecessary) join conditions in the subquery were
forcing the out part of the query to evaluate first (the
user_account_associations), and then iterate over all of those
for the subquery, instead of executing the subquery first, once,
and then checking that small result list against
user_account_associations

Change-Id: Iec4fe15dd6a902c4516c0a9e6d8b892a0b8b1fd7
Reviewed-on: https://gerrit.instructure.com/131471
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-11-01 17:25:35 +00:00
Cody Cutrer 698e26778e optimize user search query
fixes CNVS-39879

 * restrict the pseudonyms filter to the current root account
 * restructure as a "user_id IN (<union of each subquery>)" rather
   than "EXISTS () OR EXISTS () ...". In the case of a lot of users
   in an account, and the query is specific, postgres was iterating
   the EXISTS queries for every user in the account

Change-Id: I6066d818531e5a73ecefb62cad333bf726bc3f9d
Reviewed-on: https://gerrit.instructure.com/130003
Tested-by: Jenkins
Reviewed-by: Ben Chobot <bench@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2017-10-18 22:39:38 +00:00
Andrew Katsanevas a0757c75ed add a role filter to User Search
add the ability to select a role in User Search and
only see users enrolled as that role
closes CNVS-33428

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/people
- make sure the new role selector works
- make sure the correct users show up
- make sure keyboard navigation/a11y are good

Change-Id: Ib0620deb4618e06ce202ab41981e1301b3c8d256
Reviewed-on: https://gerrit.instructure.com/119365
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Andrew Katsanevas <akatsanevas@instructure.com>
2017-08-11 20:05:21 +00:00
Andrew Katsanevas 04c576cb41 adds sorting to columns in courses and people search
adds sorting to the 'Courses' and 'SIS ID' columns of the Courses tab
and the 'Name' and 'Last Login' columns of the People tab
closes CNVS-33425

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/courses
- make sure Courses and SIS ID columns are clickable and sortable
- make sure that keyboard interaction and a11y looks good
- go to /accounts/1/search/people
- do the same for the Name and Last Login columns of the People tab

add sorting by Teacher column in courses

add sorting by first alphabetical teacher to
the 'Teacher' column of the Courses tab

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/courses
- make sure the Teacher column is clickable and sortable
- make sure that keyboard interaction and a11y look good

add sorting by Enrollments column in courses

add sorting by number of students enrolled to
the 'Enrollments' column of the courses tab

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/courses
- make sure the Enrollment column is clickable and sortable
- make sure that keyboard interaction and a11y look good

add sorting by Email and SIS ID columns in People

add sorting by 'Email' and 'SIS ID' columns of
'People' search tab

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/people
- make sure the Email column is clickable and sortable
- make sure the SIS ID column is clickable and sortable
- make sure that keyboard interaction and a11y look good

change UserPane to extend React.Component

change UserPane.js to be a class that extends React.Component
instead of using the old React.createClass

test plan:
- go to /accounts/1/search/people
- make sure the user search feature works the same as before

fix queries and lint warnings

fix SQL queries based on Tyler's suggestions
and fix some lint warnings throughout

test plan:
- go to /accounts/1/search/courses
- make sure sorts still work
- make sure queries are as correct and efficient
- go to /accounts/1/search/people
- do the same
- make sure Gergich is relatively happy

sort teachers in course and lint fixes

change course search so that teachers are sorted alphabetically
within a course (if it has multiple teachers). also a few lint
fixes here and there.

test plan:
- go /accounts/1/search/courses
- make sure that teachers are sorted within a course

Change-Id: I710878bd8ce98ba2fa4eb0c357721864df338939

add a sortable column for subaccounts to course search

add a new column to course search for subaccount
make it sortable like the other columns

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/courses
- make sure the correct subaccounts are showing
- make sure the subaccount column is clickable and sortable
- make sure that keyboard interaction and a11y look good

Change-Id: Ic8b8f258c27c16982a450286f6b715c9e04d425e

fix focus for keyboard navigation in Course Search sorting

prevent the CoursesList from rerendering sometimes on sorts
so that it doesn't lose focus

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/courses
- make sure keyboard interaction doesn't lose focus

Change-Id: I6236c92f6e71596d3dc38ef756e6ac808e9e99c2

fix invalid email sorting in User Search

fix the sorting of invalid emails in User Search
so that invalid emails (that don't show up) come last

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/courses
- make sure that invalid blank emails are sorted last

Change-Id: I56e6b1e57a1d494e7667c3cfc7b14a10976ec52e

fix invalid emails showing in User Search

fix User Search so that invalid emails don't display when
the "Load More..." button is pressed

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/courses
- have more than 10 users so "Load More..." is there
- click "Load More..." and make sure invalid emails don't display
for the newly-loaded users

Change-Id: I5bc23c616ae88da73f8632699c3bde1bffee994d

fix IE11 User Search sorting issue

fix User sorting in IE11 so that it doesn't go back to the
Courses tab when trying to sort

test plan:
- use IE11
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/people
- make sure sorting works (doesn't take you to Courses tab)

Change-Id: I63491ca0b08812e21ed0ed2eb2f8a4bd1b791b89

fix add user in User Search bug where email doesn't show up

fix User Search so that when a user is added, their email
shows up without refreshing the page

test plan:
- turn on Account Course and User Search feature flag
- go to /accounts/1/search/people
- add a new user with a valid email
- make sure it displays before refreshing

Change-Id: Ib339bab3ea858c7c1ab18a6065ef4936941cb24b

remove debugger

Change-Id: Ibf88893ea35d795d8966c7580100ac135c8cfe93
Reviewed-on: https://gerrit.instructure.com/120294
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Andrew Katsanevas <akatsanevas@instructure.com>
2017-07-25 22:55:10 +00:00
James Williams 4ba94cb171 rails 5.1: lib specs
Change-Id: Ieef3d3447cfa2b22c9c9f6662688a40ae48a726c
Reviewed-on: https://gerrit.instructure.com/119730
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-07-20 17:26:51 +00:00
Landon Wilkins 45b8efda41 da licença part 36
add consistent license headers to all source files

Change-Id: I15e544768e7361fc050089a5ed4699f7ee96bb2c
Reviewed-on: https://gerrit.instructure.com/110064
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-28 17:31:17 +00:00
James Williams c6a9e3097f fix user search query with domain account on different shard
closes #CNVS-36161

Change-Id: I90d6d76f06b9bbe8a06b4df7c56f8989cf9c1771
Reviewed-on: https://gerrit.instructure.com/109120
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-04-19 19:47:05 +00:00
Cody Cutrer 259e11b92f enable searching by login_id in user search
fixes gh-1005

test plan:
 * use the search api (https://canvas.instructure.com/doc/api/users.html#method.users.index)
   with a term that only matches a user's login id
 * it should find the user

Change-Id: I9bbefc6fc9dc1c38ae5fd07ead55b3b391f8a80a
Reviewed-on: https://gerrit.instructure.com/105704
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2017-04-03 19:03:52 +00:00
Cody Cutrer 1b411ccef9 rails 5: silence another spec deprecation warning
Change-Id: Ic1bee4948715c62389845b11426e5d1d56d02dad
Reviewed-on: https://gerrit.instructure.com/104947
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-03-13 23:04:53 +00:00
Jeremy Stanley 488e4d0aa3 include unconfirmed email addresses in user search
test plan:
 - enable new user search
 - create a user but don't confirm their email right away
 - ensure the user can be found by account search by
   email address

fixes CNVS-33430

Change-Id: I9c61e8389ee6e10d5bd133cb23ab74567e1e24ff
Reviewed-on: https://gerrit.instructure.com/95730
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-11-28 21:08:06 +00:00
Cody Cutrer 132937bc27 eliminate join thru users table for sensitive assignment overrides query
fixes CNVS-32260

also do a join instead of a subquery. also revert the reverting of
doing it in SQL instead of loading a bunch of ids into memory

Change-Id: I2089b12378ad5301049a4bb427f92b1603c9c964
Reviewed-on: https://gerrit.instructure.com/91405
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-09-29 20:58:26 +00:00
James Williams d7d758302a fix performance regression on course users api endpoint
was performing an unnecessary added join for course contexts
that joined on _all_ user enrollments

closes #CNVS-30331

Change-Id: Ia0c40002aa8c963289bb00833d7719def0609d46
Reviewed-on: https://gerrit.instructure.com/84445
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-07-07 15:51:44 +00:00
James Williams f2ac48de29 don't cache user search sql
with qualified_names it can be cached for the wrong shard

closes #CNVS-29003

Change-Id: I229de61b438952093e4f730a66481a624ec4b154
Reviewed-on: https://gerrit.instructure.com/78267
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-04-29 13:47:15 +00:00
Andrew Butterfield d86f28783b Add groups context route for membership service
fixes PLAT-1447

Test plan:
* Create a course with some students
* Regression test
  /api/lti/courses/:course_id/membership_service
* Create a group with some students
* Ensure that
  /api/lti/groups/:group_id/membership_service
  returns a properly formatted list of group members

Change-Id: Idc03c11728847258d621d365d87238465f739672
Reviewed-on: https://gerrit.instructure.com/77595
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Andrew Butterfield <abutterfield@instructure.com>
2016-04-25 15:11:55 +00:00
Cameron Matheson f424cc1945 allow filtering by student view students in course users api
closes CNVS-28090

I kind of think we should be returning student view students whenever
the students enrollment type is selected, but that might be a breaking
api change.

Test plan:
  Use the course users api to return various enrollment types
  (including student_view)

Change-Id: Id8dca01e6f00198fba9e77139b1ca30348a9486c
Reviewed-on: https://gerrit.instructure.com/74611
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2016-03-18 22:13:04 +00:00
Cody Cutrer 5172abb5db fix user search returning non-scopes
makes it non-chainable for more scopes

test plan:
 * use /api/v1/accounts/:id/users?search_term=<the id of a user>&include[]=last_login
 * it should not 500, and return valid info for last_login

Change-Id: I7a4bf9dbc6bcb4e5be15a86d883467036b9de266
Reviewed-on: https://gerrit.instructure.com/74295
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2016-03-15 15:01:50 +00:00
Marc Alan Phillips 0fad3e1db6 fix assignment edit for multi-section course
Fix the edit for a multi-section course where an assignment
override is made for a student in another section than the
teacher who is editing the assignment.

fixes CNVS-23944

Test Plan:
  -Create a course with two sections.
  -Add a teacher that can only grade their section.
  -Create a quiz or assignment
  -Override with only student(s) that the sub-teacher cant see
  -Masquerade as the teacher and go attempt to edit the assignment.
  -Make a change
  -Click save and see that it now saves..
  -Repeat with override with mix of students that the sub-teacher
     can/cannot see
  -Repeat with various combos not stated that you can think of
  -Make sure to also test that groups and section overrides still work

Change-Id: I360368bf3340a15452da5e60e734817841df139c
Reviewed-on: https://gerrit.instructure.com/71526
Tested-by: Jenkins
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2016-02-28 05:50:18 +00:00
James Williams 0d821a3f63 allow inactive enrollment type
test plan:
* should be able to use the course people page to
 inactivate users (as long as you have the right to remove them)
* inactivated users should not be able to participate in the
 course (as though they were deleted), but should still show
 up in the course roster for teachers/ta's/admins
 with a label of "inactive"
 (they should not show up for students though)
* inactivated users should still show in the gradebook list
 (and their grades should be editable)

* they should not show up in other lists, such as in the
 list of students to assign to groups, or in the
 list of students that can be messaged in the inbox

closes #CNVS-24790

Change-Id: If74a37e70c5f7e2df19ac312b1ad8f9b6e83a913
Reviewed-on: https://gerrit.instructure.com/67570
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Ryan Allen <rallen@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-12-01 18:00:55 +00:00
James Williams 1cdcda1673 new account user search page
test plan:
* in development mode, enable the
 "Course and User Search" feature flag
* should be able to view the "Search" tab on the
 sidebar (may need to resave the account to
 clear the sidebar cache)
 (replaces the "Courses" and "Users" tabs)
* searching for People on the account page
 should work pretty good
 (tweaks may be forthcoming before removing the
 feature flag)

closes #CNVS-24951

Change-Id: I00a8954913201ad87d250fec7704a0bfb31abef9
Reviewed-on: https://gerrit.instructure.com/67321
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Ryan Allen <rallen@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-11-18 20:21:16 +00:00
Cody Cutrer 95df6788db exclude non-active e-mail address from user search
fixes gh-689

test plan:
 * see the github ticket

Change-Id: I90a29ca9b898c72e4aeb4c0a00ebcb3d91dd1880
Reviewed-on: https://gerrit.instructure.com/62996
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2015-09-11 16:56:48 +00:00
Cody Cutrer d723bfcc75 avoid bothering the database with pointless queries
Change-Id: Ib207ec5fbea0eb4e5fb8c36791030c8bba0b7721
Reviewed-on: https://gerrit.instructure.com/60487
Tested-by: Jenkins
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2015-08-11 20:08:03 +00:00
Cody Cutrer c472370223 use qualified table names in EXISTS subqueries
refs CNVS-21900

Change-Id: Ic49c570888ad8712d7ba93de632d952ddf2b53e1
Reviewed-on: https://gerrit.instructure.com/58629
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-07-19 00:09:24 +00:00
Michael Nomitch 35c7da6e43 api modifications for rollcall
refs CNVS-3451

test plan:
  - make api call to get users in a course
    "/api/v1/courses/#{course_id}/users"
    with enrollment_state[]=active&enrollment_state[]=invited&
    enrollment_state[]=completed
  - all users who were invited to the course
    are returned even if they arent in it anymore
  - make api call to get sections
    "/api/v1/courses/#{course_id}/sections"
    with "enrollments" in the included section
  - all user objects have an attached enrollment

Change-Id: I24d6ee31ca9a5c044efa526e762aa1d504045b99
Reviewed-on: https://gerrit.instructure.com/44717
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-12-11 17:28:45 +00:00
James Williams 81d4adc319 new roles
refactor everything that used to use strings for roles
to use actual role_ids

the apis should be backwards compatible so we don't need
to update (most of) the UI's right away in this commit

test plan:
* regression tests for permissions, role overrides,
 alerts (for account roles), enrolling users,
 adding account admins, etc.

refs #CNVS-15481

Change-Id: Id57fd3104c5c518b6fbf180609950dcddcdd474d
Reviewed-on: https://gerrit.instructure.com/41208
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-10-31 19:44:14 +00:00
James Williams 36a815448b update relative_id_for to switchman style
Change-Id: I0bc5b04d6210c90aa607e23714e7e78a2964e8ff
Reviewed-on: https://gerrit.instructure.com/29517
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-02-04 14:14:20 +00:00
Jacob Fugal cd892fe723 clean up context.users_not_in_group
for rails3 and folio

fixes CNVS-8790

test-plan:
 - validate pagination of unassigned group members both for course
   groups and account groups

Change-Id: Ic9e842abdbfba714829a123ca0dee4f93e5a1fdc
Reviewed-on: https://gerrit.instructure.com/26534
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2013-11-25 16:37:50 +00:00
Cody Cutrer d935ab98b1 deprecate Setting.get_cached
now that we have SIGHUP, we were changing everything to it anyway,
so just let caching in-proc be the default

Change-Id: Id1b44722522ac9693b17695da7107c99a359d5ac
Reviewed-on: https://gerrit.instructure.com/25020
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-10-10 00:42:52 +00:00
James Williams 0ce5f6fed0 prevent students from searching by user login/sis id
test plan:
* add a user to a course with a login and sis id
* as a restricted user (e.g. student) in the course,
visit the 'People' page
* confirm that searching by the login or the sis id
does not return the user

fixes #CNVS-7521

Change-Id: I282e2faa424378d32115db31ccee13509ee4d080
Reviewed-on: https://gerrit.instructure.com/23262
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-08-15 15:55:17 +00:00