Commit Graph

39 Commits

Author SHA1 Message Date
Brian Palmer 6c8efd8322 create the media object for submissions and comments if it doesn't exist
Check Kaltura to verify the media id is valid, then create the object,
so that we can track it as we normally do.

fixes #5775

also update some of the submission api documentation around media
comments and file uploads.

test plan: there isn't a UI to show media objects yet, so you'll have to
have console/db access. submit a video/audio submission comment through
the API, then verify that after jobs run, a MediaObject exists for the
media id you gave.

Change-Id: Id0f5b4cdc23330ea952e674df4fc0d1f1c81bf23
Reviewed-on: https://gerrit.instructure.com/12245
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-07-17 16:17:08 -06:00
Cody Cutrer dea41f5213 limit enrollments api by section visibilities fixes #8819
test plan:
 * add two sections to a course
 * add a teacher or ta to a section, and limit them to that section
 * as that teacher, go to GB2
 * you should not be able to view any enrollments outside of that
   section

Change-Id: I3d7dd17828cb79aaf162b0947640e2fa7da7952d
Reviewed-on: https://gerrit.instructure.com/11705
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-06-25 11:03:01 -06:00
Brian Palmer 581fe4330d api documentation updates
* Allow linking to individual endpoints on the page.
* Give each endpoint a summary string, and list the summaries at the top
  of the page, with links to the endpoint details.
* Make an omnibus "all resources reference" page, which has been a
  common request. This only includes the endpoint details, not the
  summary descriptions of the resources.
* Syntax highlighting for JSON

test plan: visit /doc/api/index.html and see the changes (run rake
doc:api first if on a dev box)

Change-Id: Ib126805825d40770c36b3688668c62938348412d
Reviewed-on: https://gerrit.instructure.com/10516
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2012-05-04 11:19:51 -06:00
Brian Palmer 1834401be8 file upload api, refs #7775
This API abstracts away the difference between S3 uploads and local
storage uploads, while still allowing direct-to-S3 functionality to
avoid typing up Rails processes during S3 uploads.

The only concrete starting endpoint I've implemented in this changeset
is for submission file uploads. Uploads to course and user files is
coming in a subsequent changeset.

test plan:

see the api doc (generate with rake doc:api). repeat this test for both
s3 and local storage configurations.

first, post to the submission file upload endpoint, get your
upload_params back. use that to post the actual file data to the url
returned. then follow the redirect back to canvas, and verify you can
download the file from the url given in the json response. verify you
can attach the new file as part of an assignment submission.

edge cases to test:

* in local files, verify that attempts to modify the policy will fail
  the request. in s3, amazon handles this.
* verify that if you do step 2 without step 3, the file isn't available.
* if you do step 1 but wait more than 30 min to do step 3, the upload
  will be rejected.
* make sure you can't upload twice in the 2nd step
* make sure you can't verify twice in the 3rd step

Change-Id: I9b16b6e75defe9da551b965d9401f2cad8801f1d
Reviewed-on: https://gerrit.instructure.com/9552
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-03-27 15:33:27 -06:00
Jon Jensen db48cddd3e uncheck group comment by default, fixes #7206
also added checkbox (and api support, etc.) to assignment submission
forms and gradebook2

test plan:
1.  create a group assignment
2.  as a student, go to submit the assignment
3.  ensure the group comment checkbox is present and unchecked on all
    submission forms (file upload, text entry, etc.)
4.  ensure that checking it sends a group comment and leaving it
    unchecked does not
5.  go to the submission details
6.  ensure that the group comment checkbox is unchecked by default
7.  as a teacher, go to the speedgrader and ensure the checkbox is
    unchecked
8.  go to the gradebook and ensure the checkbox is unchecked
9.  go to gradebook2 and ensure it is unchecked and functional (wasn't
    present before)
10. delete all comments and go to the dashboard. ensure that when you go
    to add the first comment, you have a working group comment checkbox
    (if there are existing comments on the stream item, you won't have a
    real comment form, just a link that looks like a text area)

Change-Id: I009b797c2b391c20f41f33c7c0b8afdd4b57dbd3
Reviewed-on: https://gerrit.instructure.com/8978
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-03-01 14:05:35 -07:00
Brian Palmer 736347bda8 student assignment submission api, refs #7171
Allows submitting an assignment as a student.

test plan (API calls):
  * submit as the four supoorted types
  * submit a comment with the submission
  * submit as a user not a student in the course, verify the 401
  * submit invalid data, verify the 400
  * as a teacher, verify you can view and grade the submission

Change-Id: Ie567d57987e2d5ed6532a0616d5a9c4681ee0364
Reviewed-on: https://gerrit.instructure.com/8717
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-02-27 10:18:32 -07:00
Brian Palmer 6ce92e5646 remove basic auth from api documentation, fixes #6716
Change all curl examples to use an oauth access token with the
Authorization header. Also cleanup of the pages discussing authorization
and oauth, and some general sprucing up of the documentation front pages.

test plan: n/a

Change-Id: I64dfe89932c4e98b6ea0f67b3ef09ba10a315444
Reviewed-on: https://gerrit.instructure.com/7764
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
2011-12-30 09:00:45 -07:00
Cameron Matheson eb9ae06f8f don't leak submission data in muted assignments in api
fixes #6565

Test plan:
* get a student with a submitted homework that has been graded
* get /api/v1/courses/#{course.id}/assignments/#{assignment.id}/submissions/#{user.id}.json,
  you should see the grade, score, etc.
* mute the assignment and re-get the submission json.  the response
  should lack grade/score/etc. keys
* check the api as a teacher, the information should still be returned.
* ditto, as an account admin with no enrollments in the course.

Change-Id: Iab46fcaae3d0485905f96f7e73e05b20c47b7435
Reviewed-on: https://gerrit.instructure.com/7297
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-12-10 06:07:50 -07:00
Brian Palmer cc26d1e0fe don't return description of locked assignments in the API
fixes #6510

Most of this is a refactor so that all API JSON generation goes through
an api_json method, in order to standardize stuff like permissions and
:include_root. The existing specs verify that this doesn't inadvertently
change any existing responses -- except the discussion topics responses,
which were returning the :permissions array in the json unintentionally.

The refactor fixes the locked assignment response as a side effect.

Change-Id: I287b366fe05ef6116f713fc52075aff93d5e87b6
Reviewed-on: https://gerrit.instructure.com/7262
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-12-09 11:15:33 -07:00
JT Olds 8dc786c883 api_find_all
testplan:
 * hit the API with a few different calls that use SIS ids (such as
   sis_user_id:whatever), and make sure calls still return the correct
   data. no calls currently use api_find_all, so nothing yet to test
   there.

Change-Id: I2804c29a18342254a94709bac93a1ffb9b0467b8
Reviewed-on: https://gerrit.instructure.com/7026
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: John Harrison <john@instructure.com>
2011-11-28 13:48:28 -07:00
Brian Palmer 132566290f use defined submission json format in conversations api
The conversations API had made up its own submission response format,
rather than using the standard submission formatting already used by
other API calls.

fixes #6289

testplan:
  * as a teacher, create a conversation with a student
  * create an assignment, and have the teacher and/or student comment on
    the assignment submission
  * verify those comments still appear in the conversations web ui
    verify that the submission and comments now come back in the api
    using the same format as the submissions api, with assignment and
    comment data included
  * make more than 10 comments, verify that only 4 are displayed at
    first, then 10 total, and a link provided to view the full submission.

Change-Id: I05a37a1498fa3d6a1ab908c462a04d28f2854eb8
Reviewed-on: https://gerrit.instructure.com/6852
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2011-11-10 17:00:24 -07:00
Jacob Fugal f692ddc2aa allow students to comment via API; fixes #6083
but don't allow them to grade :)

test-plan:
  * attempt to post entry to discussion through api as student; should
    succeed
  * attempt to post reply to entry through api as student; should
    succeed
  * attempt to set graded through api as student; should be unauthorized
  * attempt to apply rubric through api as student; should be
    unauthorized
  * attempt to set grade and/or apply rubric through api as teacher;
    should succeed

Change-Id: I4215ef02d1b0e3b68661fd6ab228be203d45526c
Reviewed-on: https://gerrit.instructure.com/6780
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-11-10 13:02:48 -07:00
Brian Palmer ed275b3293 restrict submission actions to sections
teachers and TAs can be limited to a specific section, in which case we
need to enforce those limitations in the submissions api.

testplan: set up a course with 2+ sections, and a teacher who is only
allowed to access 1 of those sections. then verify:
  * GET /submissions should not list users in other sections
  * GET /submissions/:id for a user in another section should 404
  * PUT /submissions/:id for a user in another section should 404
  * GET for_students with user ids in other sections should not return those users
  * all of the above should return no submissions if the user attempts to access the api via /sections/:section_id of the other section

close #5859

Change-Id: I102b13d1462f588277ca559f418785452e58e816
Reviewed-on: https://gerrit.instructure.com/6796
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-11-10 12:08:58 -07:00
Brian Palmer b9b5409d39 add readResult support to LTI grade passback, refs #5892
testplan: you can set up an assignment as an external_tool type
manually, and then hit the IMS certification test tool to verify that
replaceResult and readResult are now fully supported.

Change-Id: Id193ba1943f51b3cb4b6a2d078d8a2262c26659e
Reviewed-on: https://gerrit.instructure.com/6678
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
2011-11-04 09:42:23 -06:00
Ryan Shaw 41e232007e check attempt not @submission in submissions api
Change-Id: I49f3b338a71e46c8bea3d561c3d6ddc526dbb3f6
Reviewed-on: https://gerrit.instructure.com/6119
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2011-10-11 14:50:56 -06:00
Ryan Shaw b5603306ef send turnitin data back in api
Change-Id: I1bdabc2e080c616c4d96e0cb88749b16da2cfa7d
Reviewed-on: https://gerrit.instructure.com/6089
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-10-11 12:52:39 -06:00
Ryan Shaw d498350329 don't 404 for submission that was not created yet
Change-Id: I67dffd8f8fce13e3ac21f988e67f7e84d9eba4d0
Reviewed-on: https://gerrit.instructure.com/6090
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-10-11 09:13:27 -06:00
Jon Jensen 4e884adfdf return attachment and media comment urls, closes #5850
Change-Id: I971a02d2055778120a0a5df0129f2b145da98843
Reviewed-on: https://gerrit.instructure.com/6045
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-10-10 12:26:00 -06:00
Jacob Fugal 5c8406bd35 GroupCategory model
Group#group_category_name (groups.category) and
Assignment#group_category_name (assignments.group_category) are now
deprecated.

refs #4624

Change-Id: I8fc5d03a75e962c3f649305986f77ad242d3a694
Reviewed-on: https://gerrit.instructure.com/5765
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-10-10 09:36:06 -06:00
Ryan Shaw 87588f5307 add media_comment_id and media_comment_type to api
this is because we need it in $.fn.mediaComment('show')

Change-Id: Ia53912ef8bf25e255463234bf1bb1f806cf49dfa
Reviewed-on: https://gerrit.instructure.com/6028
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-10-10 07:49:19 -06:00
Brian Palmer d51b5d9a73 don't require a session to download attachments through the api
fixes #5737

There is one situation where a session is still desireable -- if the
attachment data includes links, for instance a html file attachment,
then a session will be needed to view the links from that file. The
limited safefiles session will still be created when downloading the
file, so apps can optionally use the session to support that
functionality.

Change-Id: I48558c4a3217ebea92118f8f08d1254041bd65e5
Reviewed-on: https://gerrit.instructure.com/5860
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-10-07 17:04:43 -06:00
Brian Palmer 718c3d01be support section ids in the submissions api, refs #5835
Change-Id: Ibbe8f3852e8674c963e735b3f0fe8982d5ad7244
Reviewed-on: https://gerrit.instructure.com/6014
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-10-06 13:41:06 -06:00
Brian Palmer e4e590b4ff don't error for_students api if no assignments in the course
fixes #5808

Change-Id: Ice8787355d33c7a23f988a27182fcc4f0f4f4ab9
Reviewed-on: https://gerrit.instructure.com/5980
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
2011-10-05 09:22:09 -06:00
Brian Palmer 5cd5e648a6 optimizations for submissions for_students api, refs #5806
* fix a bug in Api.map_ids that was causing a worthless SELECT for each id given
 * pre-load all the assignments and manually set them on the
   submissions, to avoid those individual queries
 * if sis ids are given, resolve them to AR ids all in one query, rather
   than individually
 * allow excluding attachments and discussion_entries using the
   response_fields/exclude_response_fields functionality

Change-Id: Ib48016f8440959a08637385f0ccaa23d40e7adde
Reviewed-on: https://gerrit.instructure.com/5975
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
2011-10-04 17:11:46 -06:00
Jacob Fugal 530c5e1bdc group_category_name
wrap Assignment#group_category and Group#category accessors as
Assignment#group_category_name and Group#group_category_name accessors,
respectively, in order to make naming consistent and free up the field
"group_category" for a new association.

Change-Id: Ieb926088d96ebb8b46f70768a77b82fa1dcc8817
Reviewed-on: https://gerrit.instructure.com/5761
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-09-27 12:58:50 -06:00
Brian Palmer 829f7f79a7 api attachment_json improvements, fixes #5642
* correctly return attachments with Assigment contexts
 * filter out nil responses from attachment_json

Change-Id: I8c6df46d47ab817bc9d7771257aef9212471e392
Reviewed-on: https://gerrit.instructure.com/5681
Reviewed-by: BJ Homer <bj@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-09-16 14:15:59 -06:00
Brian Palmer b317f0d264 clean up user querying in the api, refs #4756, #4746
Finding users is a bit different, since the user's sis information is
actually stored on the pseudonym. Before, we were working around this in
the submissions api. I've generalized it to work everywhere that uses
the Api find functionality, and in the process fixed the page views api
so that it works with sis ids.

This is necessary as we add more user apis, like the upcoming
/users/:user_id profile API.

Also added the /users/self shortcut to query the various user apis for
the user accessing the api.

Also for consistency, deprecate users/activity_stream in favor of
users/self/activity_stream

Change-Id: Icb0776231070b838bb341893d12b1061b90c5d04
Reviewed-on: https://gerrit.instructure.com/5628
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-09-13 12:33:45 -06:00
Bracken Mosbacker b3167f4640 start discussion topic api
refs #4752

Change-Id: I54712c27ef1c496c2c92f7805240ca91405b2858
Reviewed-on: https://gerrit.instructure.com/4797
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-07-28 12:05:18 -06:00
Brian Palmer 493a26d541 use more specific sis field names in api, and support both user sis ids
users have both a SIS user_id and login_id, return both in the API and
allow both as ids when specifying a user in API calls using the syntax
sis_user_id:someid and sis_login_id:someid

These columns in the db aren't well named, unfortunately, but we'll try
to at least be consistent in the API.

This is technically a breaking change for the API. We've decided to go
ahead with it, as this API functionality was only recently added.

Change-Id: I8eabe4226580aa3b1aec7e5b7082b045f786e605
Reviewed-on: https://gerrit.instructure.com/4556
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-07-07 15:44:25 -06:00
Brian Palmer 4ddce72a8e extend submissions for_student api for gradebook2
Change-Id: I32c9ae92495ebb3fecca52983a3b50dcd162b620
Reviewed-on: https://gerrit.instructure.com/4399
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
2011-06-28 16:15:41 -06:00
Brian Palmer 1eb9777934 allow students to access their own submissions via API, closes #4748
This is a read-only view, it doesn't allow students to submit homework
through the API.

Change-Id: Ibb23d0f99d0c77b24b9c31fe204f97afcc5bb53c
Reviewed-on: https://gerrit.instructure.com/4339
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-06-24 08:15:33 -06:00
Brian Palmer ace397540a support sis ids in the canvas apis, closes #4386
Change-Id: I2ae2a447f3950d09257b9ff6498326ec89c8bed8
Reviewed-on: https://gerrit.instructure.com/3621
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2011-05-16 13:25:07 -06:00
Mark Suman 88242820c8 added grade_matches_current_submission to submission api response
fixes #4240

Change-Id: I3e6b6e0406f815fb50972bd606794116907ac848
Reviewed-on: https://gerrit.instructure.com/3033
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-04-12 12:45:15 -06:00
Brian Palmer 3cf394644e api for retrieving submissions by student, refs #4156
Change-Id: Iffa4527ff11fcbb0ca798b1bf3c7572826648174
Reviewed-on: https://gerrit.instructure.com/2983
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-04-07 14:12:26 -06:00
Brian Palmer 785d301610 don't return submissions for un-enrolled students in the api
fixes #3959

Change-Id: I505dea4260c586cc1033f7a5600c350d67af989f
Reviewed-on: https://gerrit.instructure.com/2949
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-04-06 10:32:09 -06:00
Brian Palmer 58aa885ad8 provide preview_url in submissions api response, closes #3957
I also had to change the api spec stuff a bit, which caused some changes
in other specs.

Change-Id: I62e87fa4c9e79716455ca47ca342c9eec86ddc39
Reviewed-on: https://gerrit.instructure.com/2848
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-03-29 08:49:50 -06:00
Brian Palmer f9e08ea3c5 teach the api how to download discussion topic assignment attachments
fixes #4094

Change-Id: Ib06526ab73c8f80a17f07c9d2f9a3210f66ff47b
Reviewed-on: https://gerrit.instructure.com/2782
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Mark Suman <marks@instructure.com>
2011-03-24 13:11:40 -06:00
Brian Palmer d8e0e10a13 retain the grade if another submission API PUT is made without one
fixes #3718

Change-Id: I04868f68defcccf11cc51a40ca65047a2e38d935
Reviewed-on: https://gerrit.instructure.com/2169
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-02-04 15:54:18 -07:00
Brian Whitmer 8b8173dcc9 Initial commit.
closes #6988138
2011-01-31 18:57:29 -07:00