Commit Graph

101 Commits

Author SHA1 Message Date
James Williams 7423e4fb94 rails 5.2
closes #CORE-1301 #CORE-1302

Change-Id: I687132b066d12cf35e3c7a593dff9b2a91337f33
Reviewed-on: https://gerrit.instructure.com/147220
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2018-04-25 19:15:20 +00:00
Cody Cutrer ea1e234f22 filter page views by accessible accounts
fixes CNVS-39916

test plan:
 * enable page views (repeat once each for db, cassandra, pv4)
 * have a user associated with multiple root accounts
 * as that user, browse around both accounts
 * as a site admin, view the user; you should see all page views
 * as an admin in only one of the accounts, you should see only
   the page views from the same account

Change-Id: I79c5788c30ef87c7ff6a2ad31a909f9947e7b35c
Reviewed-on: https://gerrit.instructure.com/129850
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2017-11-08 18:22:38 +00:00
Landon Wilkins dd4b4930f0 da licença part 14
add consistent license headers to all source files

Change-Id: Idbd9f8628058af7dbdb63ad985f23ad843383262
Reviewed-on: https://gerrit.instructure.com/110035
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:30:12 +00:00
Cody Cutrer 327e0d7900 move object caching into ConfigFile itself
refs CNVS-36051

we often want to cache an object built from the config we got, so
move that up so we don't keep repeating ourselves

Change-Id: I9c58993b6142cec41f4514dcb1a74dd5d5582234
Reviewed-on: https://gerrit.instructure.com/107166
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-04-07 19:43:54 +00:00
Cody Cutrer e04667a89f rails 5: change alias_method_chain to prepended modules
fixes CNVS-33377, CNVS-33697, CNVS-33699, CNVS-33700, CNVS-33701

Change-Id: I4ed1340a3b1472200ac59ddc4c0f7111e9418db0
Reviewed-on: https://gerrit.instructure.com/101509
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
2017-02-10 19:42:29 +00:00
James Williams 89370c5f11 remove protected_attributes
refs #CNVS-32574

Change-Id: I3ba018a7110a7530c9af4a59c97422f626a749b6
Reviewed-on: https://gerrit.instructure.com/99260
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-01-12 17:46:18 +00:00
James Williams 6003431940 strong params part P-R
refs #CNVS-32574

Change-Id: Ic3cd179a7cfb22e3b25a72500313f1baa8f96bb9
Reviewed-on: https://gerrit.instructure.com/94680
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
2017-01-10 19:46:18 +00:00
James Williams b907f6e88b don't explode logging page views for non-standard contexts
Change-Id: If6f6aa70734be8e53d77044ce2f26d949fc825a1
Reviewed-on: https://gerrit.instructure.com/90330
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-09-15 16:54:46 +00:00
Cody Cutrer bf0dc3f022 "fix" direct page view lookup with pv4 for audit apis
refs CNVS-23365

Change-Id: I995b50e4951fd6a45e703bca58277a0bd7206227
Reviewed-on: https://gerrit.instructure.com/86898
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-08-04 18:34:26 +00:00
Cody Cutrer f64a73a99f display app name in page view output
closes CNVS-28788

test plan:
 * enable page views
 * use an app (such as Canvas for iOS) to interact with your
   Canvas, and record page view (particularly ones that count
   as "participations")
 * look at the page views for the user
 * instead of listing a browser for the user agent, it should
   list the name of the developer key for the app

Change-Id: Id07b293db333e44db7110fc2620409535927f915
Reviewed-on: https://gerrit.instructure.com/77409
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-05-02 21:25:54 +00:00
Rob Orton d236166297 drop mysql support and gem
test plan
 - specs should pass

Change-Id: Ib3f102b53d947198625e3118820d22e77a005dd6
Reviewed-on: https://gerrit.instructure.com/77249
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2016-04-19 19:55:55 +00:00
Cody Cutrer 044e76b26d fix not-writing page views anywhere, but still work with PV4
refs CNVS-27294

test plan:
 * Setting.set('enable_page_views', 'pv4')
 * navigate around canvas
 * existing pageview instructure should continue to work, including
   interaction seconds updates, and pv data in response headers

Change-Id: Ifa9dd60f244c3b2b3e4274da2301db5b736f03df
Reviewed-on: https://gerrit.instructure.com/73555
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2016-03-22 19:33:29 +00:00
Cody Cutrer fb64908614 expand "native" polymorphic associations to most polymorphics
Change-Id: I0b2ada85ae6d7b32d2940f5c7db6596b27c3bf84
Reviewed-on: https://gerrit.instructure.com/72282
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-02-22 19:14:31 +00:00
James Williams b1f3daf044 rails 4.2: misc spec fixes
refs #CNVS-26056

Change-Id: Ia94ee2fcfded1ec66cb77a19085b005c81304800
Reviewed-on: https://gerrit.instructure.com/70251
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-01-18 21:45:39 +00:00
Michael Nomitch 757d9202d8 remove unused constants from canvas models
fixes CNVS-26220

test plan:
  - none

Change-Id: I40e675550e25a8c88795a4ddcd0d05e8470ada69
Reviewed-on: https://gerrit.instructure.com/69752
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Anthus Williams <awilliams@instructure.com>
QA-Review: Mike Nomitch <mnomitch@instructure.com>
2016-01-12 17:39:22 +00:00
James Williams 280e4c4702 remove class_eval from page_view
leftover from rails 3 transition

Change-Id: I085b9bb9cdeeac38d0f94690e514fba58322233c
Reviewed-on: https://gerrit.instructure.com/69425
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-12-29 22:09:51 +00:00
James Williams d2833299d7 remove rails 3 support
also add initial rails 4.2 scaffold

refs #CNVS-25988

Change-Id: Ifd7aecaffb6cfc8a3e41bc3fb011fb6ce0664ea6
Reviewed-on: https://gerrit.instructure.com/69129
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-12-23 21:36:43 +00:00
Zach Wily 5955051e5f send interaction_seconds updates in response headers
Closes CNVS-23363
Closes CNVS-24692

Include interaction_seconds updates to previous requests in
request metadata.

Instead of passing around a page view id, we are now passing around the
URL used to update the current page view. This URL includes a page_view
token, which is a JWT including the page view id, user id, and page view
creation time.

Previously the DOM was used to store the page view id of the current
page and the update URL. The update URL now is sent via js_env. The
DOM node with the page_view_id is left in place in case any 3rd party
javascript is querying it (but nothing in Canvas should be).

This change also logs in metadata the page view creation time. This
is so we can correctly correlate the updated page view with the original
page view (using its id and creation time).

There is also a mechanism to send a new update URL in AJAX requests,
which is preserved with this change.

Some code to send the page view id with every ajaxJSON request was
removed, as it appears completely unused.

Also fixed a bug that was preventing the "store page view info
in cookie on pageunload so the next request can send the update"
code from working. When setting the cookie, it was not specifying
a Path, so the cookie only got set on the current path. Now it
will always be handled on the next request.

test plan:
 * Open Network Inspector to see requests being made
 * Open a page that constitutes a "page view" (like a course's
   discussion page)
 * Note the X-Request-Context-Id response header for the request you
   just made. This is your current page view id.
 * Move your mouse around a whole bunch on the page you're on. This
   generates "interaction time".
 * Eventually, you'll see a new request pop up to /page_views. Look
   at the response headers for X-Canvas-Meta. It should have a field
   r=<guid>|<timestamp>|<seconds>. The `guid` field should match the
   page view id from the original page you loaded, and `seconds`
   should be about how long you've been moving your mouse around.

Change-Id: I7c418c1c690e7c2384fbcae86f21f5081b834a7e
Reviewed-on: https://gerrit.instructure.com/63818
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Zach Wily <zach@instructure.com>
2015-11-18 03:20:51 +00:00
Cody Cutrer 32fe4b9873 pv4 for reading only
fixes CNVS-24219, CNVS-24220, CNVS-24221

test plan:
 * configure pv4.yml with a uri and an access_token
 * Setting.set('read_from_pv4', 'true')
 * load a users profile; you should see page views
   with all fields and can scroll through them

Change-Id: If5dfcb1596eba8e9da6f46b6a19fbb88ba422f0e
Reviewed-on: https://gerrit.instructure.com/66545
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2015-11-16 20:36:49 +00:00
Jacob Fugal 5994037b67 also log errors on page views
fixes CNVS-24569

Change-Id: I1f1a8ccefe9bf1afc94dc78227a1c2bd8cea791b
Reviewed-on: https://gerrit.instructure.com/65822
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2015-11-10 02:22:01 +00:00
Cody Cutrer 92ec509917 helper method for getting active user counts by shard
Change-Id: Ic52e5822e0444f0fa55f9a3384630ac42f031be0
Reviewed-on: https://gerrit.instructure.com/60442
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-08-24 15:16:42 +00:00
James Williams 6f51f99fa6 rails4: fix page views
refs #CNVS-21596

Change-Id: Iee7997b0f22c26b3393b08506b0b46ec4f0e8620
Reviewed-on: https://gerrit.instructure.com/58204
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-07-13 15:25:03 +00:00
Cody Cutrer d1f08ad993 the cassandra migrator does not need to be shard aware
especially when it's flat out wrong and causes it to not work

even when run in a sharded environment, it's run per-shard anyway

Change-Id: I6f568b44a6fe636468372e708cfcdcb329d4a733
Reviewed-on: https://gerrit.instructure.com/46744
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-01-12 22:23:26 +00:00
James Williams 81558f728c remove rails 2 support
closes #CNVS-14261

Change-Id: I1b0e8a4438ab659ecd1ac8462bc3559d810989b3
Reviewed-on: https://gerrit.instructure.com/38744
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>
2014-08-06 18:16:19 +00:00
James Williams 794b61783c fix page view controller and action logging in rails 3
test plan:
* enable page views in rails 3
* using the api, retrieve the page views for a user
* the 'controller' and 'action' fields should not be null

fixes #CNVS-13769

Change-Id: I19748f0f4bb455c8932283adf2a04b2f7d445554
Reviewed-on: https://gerrit.instructure.com/36886
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-06-26 16:47:42 +00:00
Braden Anderson 0fb77b4079 profile: fix valid page views context
fixes CNVS-13451

test plan:
  * enable page view storage in cassandra
  * open Canvas
  * click "Settings", in the top right
  * verify that the page renders successfully

Change-Id: Ia4193f59e41f6993b61a05bbb853a8e601285d8f
Reviewed-on: https://gerrit.instructure.com/35950
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Anthus Williams <awilliams@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-06-05 15:45:53 +00:00
Braden Anderson 45d19f3003 validate types on polymorphic associations
fixes ALYT-26

test plan:
	* regression test

Change-Id: Ie93e89b842e354f1f76d75f3492145b86c79a035
Reviewed-on: https://gerrit.instructure.com/34560
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-05-28 17:05:34 +00:00
Cody Cutrer a99e904d11 fix cassandra page view sharding issue
fixes CNVS-13024

test plan:
 * configure cassandra page views
 * as a user from shard 1, visit a course on shard 2
 * go to /users/self on shard 2, and watch the network requests for
   page views. in the response, the context should be a local id, and
   the user should be a global id

Change-Id: I6bbc54d9b055aff74b81441b2449c4548fd96816
Reviewed-on: https://gerrit.instructure.com/35056
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-05-20 21:55:09 +00:00
Nick Cloward 19ea2789dd canvas event stream
fixes: CNVS-10477

Test Plan:

Make sure auditing still works.

Change-Id: I021c0772ad0cf337d452b55bf690d15ce1a61a09
Reviewed-on: https://gerrit.instructure.com/31494
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2014-05-14 19:09:24 +00:00
Anthus Williams 828981e72c define exportable attributes/associations on models
instead of passing an :exportable option to
ActiveRecord::Associations, simply define a constant
on the class containing exportable associations and
attributes. This is due to :exportable breaking
ActiveRecord, and we can't simply monkey-patch in
config/initializers because models are included in
migrations before the initializers are run

Change-Id: I11f1a6b4570c397d8e01010c517bc6efdac7afca
Reviewed-on: https://gerrit.instructure.com/33235
Reviewed-by: Braden Anderson <banderson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Anthus Williams <awilliams@instructure.com>
QA-Review: Anthus Williams <awilliams@instructure.com>
2014-05-06 23:54:24 +00:00
Brian Palmer 02fba1e3d0 remove page_views.contributed
An audit of the related code revealed that this column is unused

test plan: After running the drop migrations, ensure that page views are
still logged correctly and can be viewed via the UI/API/CSV

Change-Id: I9141661440513d0c21ec0fdb5f0bd80dbb7c1c55
Reviewed-on: https://gerrit.instructure.com/30743
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2014-03-10 21:23:52 +00:00
Brian Palmer e1007850d3 fix backwards compatibility failure
We attempted to make this backwards compatible when removing the cache
queue support, but the old setting was "cache" not "queue"

Change-Id: I7f419365089a1d99dae5dec3e3f7cb18a92ae05f
Reviewed-on: https://gerrit.instructure.com/31030
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2014-02-28 21:00:35 +00:00
Cody Cutrer 1045b0dc06 fix page view on cassandra for rails 3
* small fix for creating - need to set created_at
 * override finder methods more directly (in rails 3, they all go
   through relation, which we can't override just for PageView)

Change-Id: I33476eaf67180a45c26b70110ca1f9801dff8f44
2014-02-19 09:44:14 -07:00
Cody Cutrer 3f8f24998c fix page view insertions for cassandra on rails 3
Change-Id: Id8a1c3fad26fbd6cf7bb76dbe89e862d0da11540
Reviewed-on: https://gerrit.instructure.com/30106
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-02-14 15:56:42 +00:00
Jacob Fugal eb8071b64c fix usage of request.method to work with rails3
refs CNVS-4704

Change-Id: I1edc42653fd76a74fc0cf87b7e99f73aa1274adc
Reviewed-on: https://gerrit.instructure.com/30097
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2014-02-13 21:25:03 +00:00
James Williams c13845ce0f use assign_attributes instead of attributes= for rails 3 compatibility
Change-Id: I783618bc5457ea53a9d59ab36d3ccf7b7fde7b2e
Reviewed-on: https://gerrit.instructure.com/29595
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-05 20:56:38 +00:00
Cody Cutrer 02e1e15c30 fix PageView migrator spec on mysql
refs CNVS-7032

 * be prepared for timestamps that are already timestamps
 * handle no sub-second precision in our batch size assumption

Change-Id: Ic286750a275acec28c60feb145733e9e41cbc12a
Reviewed-on: https://gerrit.instructure.com/29499
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-02-04 17:17:15 +00:00
James Williams 1075812645 fix page_view after_initialize callback for rails 3
Change-Id: If87f098435b873074295586a112734a7ce6087a1
Reviewed-on: https://gerrit.instructure.com/29038
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-01-22 19:49:16 +00:00
Anthus Williams 96ada4aa58 downcase http_method in pageview for version compatibility
in rails 3, request.method returns "POST" but in
rails 2, the result is "post".

Change-Id: Ia751b4db5f516bd3e62f15215d7918465fd7c418
Reviewed-on: https://gerrit.instructure.com/28543
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Anthus Williams <awilliams@instructure.com>
Product-Review: Anthus Williams <awilliams@instructure.com>
QA-Review: Anthus Williams <awilliams@instructure.com>
2014-01-17 18:56:28 +00:00
Cody Cutrer fe8063ac4f don't parse a Time as a string
Mysql2 returns times as times, instead of strings

refs CNVS-7032

Change-Id: If1a1d0760cf1b7817bb34383c42865c0482a84d0
Reviewed-on: https://gerrit.instructure.com/28777
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-17 17:54:20 +00:00
Cody Cutrer 814dc74a4b use select_all, not execute
execute has an undefined return type that varies by adapter

refs CNVS-7032

Change-Id: Ia3004cf743afb038ad522588d1ad5d3b0fa9ebe5
Reviewed-on: https://gerrit.instructure.com/28616
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-16 21:22:39 +00:00
James Williams 70fa975524 use self.primary_key and self.table_name
in order to avoid rails 3 deprecation warnings

Change-Id: If4c6ece9496e1161718770420384003de23f0421
Reviewed-on: https://gerrit.instructure.com/28206
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-01-09 12:34:12 +00:00
Anthus Williams c6808ec567 force encoding on all string fields in page views
The idea was to have a generic solution so
if we add fields to be tracked and exported
or displayed to users, we don't forget to force
the encoding and thus end up with an obscure
bug we only see in production.

Fixes CNVS-9528

Test plan
- in production environment
- Go to a users account details page where they
  have page views.
- Download the CSV file from the top right corner
  of the page views listing.
- Open the CSV file and check the "Remote IP"
  column to the far right.

Change-Id: I83250f218936c8af0b3a7ae2ff69e777034e731c
Reviewed-on: https://gerrit.instructure.com/26798
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Anthus Williams <awilliams@instructure.com>
2013-12-19 00:15:26 +00:00
Nick Cloward 711f33c07e add option for course grade change (log auditing)
fixes: CNVS-348

This adds grade change auditing functionality.  It uses cassandra and is built
after the authenication auditing.  A new API endpoint was created to query these
logs.  Permissions for this is a domain account.  The logs can be quiried by
assignment, course, student, and grader.

Refer to: https://gollum.instructure.com/grade-auditor-implementation

Test Case:

  Setup:
    - Create a course with a student and an assignment.

  1. Grade an assignment for a student.
  2. The auditor should create a record in cassandra.
  3. Query the endpoint should return the audit event.
      - Query by Assignment
      - Query by Course
      - Query by Student
      - Query by Grader
  4. Ensure permissions are valid by querying with a non root account admin.
  5. Permissions should be changable by site_admin under account permissions.

Change-Id: I0a1cf867d5d1b5bfbdeacc7eac81747f8732025a
Reviewed-on: https://gerrit.instructure.com/25961
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2013-11-21 20:53:27 +00:00
Brian Palmer 3c9079042d enable page view interaction_seconds updates for cassandra
This wasn't working because we weren't loading the existing page view
from cassandra, so the user_id nil check was failing.

Also add the Setting to this codepath in case we need to turn off page
view updates for performance reasons.

fixes CNVS-2129

test plan:
* visit a course interaction page such as viewing a discussion topic
* turn on your web inspector
* spend some time on the page, scrolling around, clicking, doing things
  that register as activity
* eventually you'll see an ajax request to /page_views to update the
  interaction_seconds timer. this can take more than 5 minutes though --
  the faster way to trigger it is to "interact" with the page for at least
  30 seconds, and then navigate to another canvas page. that'll trigger
  the page view update ajax call when the next page loads.
* visit /users/self and look at your page view history, the page view
  should have the updated interaction seconds value. same with the csv
  download of page view history.

Change-Id: I35a67450c0f3360720ff0c18fe9730ead607d5e0
Reviewed-on: https://gerrit.instructure.com/25871
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2013-10-31 22:23:56 +00:00
Brian Palmer 663fe865fd remove the page view redis queue support
This has been phased out, so is just needless complexity.

refs CNVS-2129

test plan:
* page views should still be stored and queried via cassandra or postgres

Change-Id: I0e5580086c912396b7e4cdfb139eb3a1acc4f67c
Reviewed-on: https://gerrit.instructure.com/25859
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2013-10-31 22:23:47 +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
Brian Palmer e1b650f53f log the remote_ip in page views
refs CNVS-8392

also update the page view API documentation

test plan:
* with this commit applied, page views will now log the remote
  ip of requests, and return that ip in the api and csv downloads
* regenerate api docs with rake doc:api, and verify that the user
  section now has expanded information on the api response

Change-Id: If463e211515881db6ce1f75c9bbca8c7fbcf7589
Reviewed-on: https://gerrit.instructure.com/24880
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2013-10-07 15:04:50 +00:00
Brian Palmer 24ea90238e make sure the page view data is utf-8 encoded
Sometimes these pieces of data coming from the request are marked as
binary (ascii-8bit) encoded, which causes the cassandra-cql gem to
hex-encode them before sending them to cassandra.

We never noticed before because the round-trip JSON encode/decode
through redis was forcing utf-8 encoding.

refs CNVS-7551

test-plan:

Without this commit, page views would show the user agent as unrecognzed
in the /users/X page views UI. However, depending on your test
environment this might not happen, it depends on the encoding of your
web/rack server. With this commit, it should be fixed regardless.

Change-Id: I85d6dc9eabe0052e9cc5e6b9e690b318d1a4d72b
Reviewed-on: https://gerrit.instructure.com/23381
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2013-08-16 01:23:51 +00:00
Jacob Fugal fa157fcc33 skip redis queue for cassandra page views
fixes CNVS-7551

unless specifically told otherwise, write cassandra page views straight
to cassandra without putting them through the redis queue first. can
still cause them to go through redis queue by setting
'page_view_cassandra_uses_redis' to 'true'.

test-plan:
 - have cassandra page views enabled and set up
 - turn off delayed jobs
 - navigate to some pages
 - generated page views still show up
 - set 'page_view_cassandra_uses_redis' setting to 'true'
 - navigate to some more pages
 - generated page views don't show up (yet)
 - restart delayed jobs
 - generated page views show up

Change-Id: I66a2991d41e18e1440e5eb68db6aa3d217577f41
Reviewed-on: https://gerrit.instructure.com/23325
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
2013-08-15 15:24:44 +00:00