Commit Graph

158 Commits

Author SHA1 Message Date
Alex Boyd 98ed7a5213 Only grant group permissions to users who can read the group's context
Fixes CNVS-19702

Test plan:
 - Create a course with a start date in the future
 - Add a student
 - Create a group set and group
 - Add the student to the group
 - As the student, visit the group directly (i.e.
   /groups/<group_id)
 - Verify that you get an unauthorized error
 - Regression test groups, ensuring that students in active
   courses are still allowed to do all of the things they
   should be able to do

Change-Id: I60ef5b938de1a965ffe987d96e2beb5db86f0759
Reviewed-on: https://gerrit.instructure.com/55251
Tested-by: Jenkins
Reviewed-by: Mark Severson <markse@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Alex Boyd <aboyd@instructure.com>
2015-06-17 19:39:13 +00:00
Strand McCutchen d6597c107c fix Style/EmptyLineBetweenDefs issue
Change-Id: Ib7b824043a7ac9196f06020e2ca42fe983565f0d
fixes: CNVS-20009
Reviewed-on: https://gerrit.instructure.com/52919
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Strand McCutchen <smccutchen@instructure.com>
QA-Review: Strand McCutchen <smccutchen@instructure.com>
2015-04-29 16:28:39 +00:00
Cody Cutrer 9834937c8c don't autorequire a bunch of gems that are rarely used
Change-Id: I09ed3686629b62849d392684d587f30cb2047013
Reviewed-on: https://gerrit.instructure.com/51853
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-04-09 18:47:50 +00:00
Simon Williams 5df1e3249a fix :view_group_pages permission for discussions
closes CNVS-19175

test plan:
- enable "View the group pages for all student groups" for students
- create a group set in a course
- as a student in group A, go to group B's discussion index page
- it should load

Change-Id: Ia1703192fbbf380b614d11760d133db0d3d5e9b5
Reviewed-on: https://gerrit.instructure.com/50129
Tested-by: Jenkins
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-03-26 22:08:03 +00:00
Michael Nomitch 938184b8ac DA - fix group discussion index
fixes CNVS-19165

test plan:
  - turn DA on
  - go to the group discussion index page
  - go to a group discussion
  - nothing errors out

Change-Id: I87fbec441f9348285af372d7b9413e727841e9e0
Reviewed-on: https://gerrit.instructure.com/50140
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-03-24 19:45:26 +00:00
Simon Williams 5e16de49b8 add permission flag for announcements to group and course APIs
The APIs for groups and courses allow the caller to supply a
?include[]=permissions flag.  The call did not return permissions for
announcements, meaning that the mobile clients had to guess.  If they
guessed wrong, then students would find out AFTER composing the message
that they didn't have permissions.  With this change announcement
permissions are communicated as well.

fixes CNVS-18585

test plan:
- Setup a teacher who is part of a course
- call the show api, passing it include[]=permissions and see that
	create_announcement is true

- Setup a student who is part of a course
- call the show api, passing it include[]=permissions and see that
	create_announcement is false

- Setup a student who is part of a group
- call the show api, passing it include[]=permissions and see that
	create_announcement is true

Change-Id: I04ce17416405f8bdf0c9fe0d63f3f29bd7cb07b6
Reviewed-on: https://gerrit.instructure.com/34413
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-03-19 18:00:20 +00:00
James Williams 63c511b717 don't send group membership notifications for unpublished courses
test plan:
* create a course, leave it unpublished
* enroll a student
* as the student, set notifications for "Group" -
 "Membership Update" to ASAP
* create a group in the unpublished course
 and add the student
* the student should not receive a notification

closes #CNVS-6008

Change-Id: I38f3009222a50ac0cf016d18f6daf39add33f3a0
Reviewed-on: https://gerrit.instructure.com/50055
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-03-11 13:51:22 +00:00
James Williams 035cf861d4 don't allow users to create conferences without the permission
test plan:
* enable a web conference plugin
* add a teacher to a course
* create a group
* as the teacher, should be able to create
 conferences for the course and group

* as an account admin, disable the permission
 to "Create conferences" from the teacher role
* the teacher should no longer be able to create
 conferences

closes #CNVS-5370

Change-Id: Ic0955bd09b09e5026754f754077889904918cbbb
Reviewed-on: https://gerrit.instructure.com/49856
Tested-by: Jenkins
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-03-05 16:25:25 +00:00
Michael Nomitch f4454b4387 graded discussion edit permissions
fixes CNVS-5548

test plan:
  - go to course settings and disallow students
    from editing discussion posts
  - make a graded group discussion
  - as a student, go to this discussion and reply to it
    - from the groups url you cannot edit your post
      (/groups/:group_id/discussion_topics/:disc_id)
  - as a student
    - make a new discussion from the group page
    - you cannot edit your replies on this
  - teachers can edit as usual

Change-Id: I26b12a283d6e12879e170a598c97b9e25c5e597d
Reviewed-on: https://gerrit.instructure.com/49019
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2015-02-19 22:57:33 +00:00
James Williams 9ef2e79bbb refresh subtopics when a group is added
test plan:
* create a group set
* create and publish a group discussion topic
 pointing to the group set
* add a group to the set
* add a student to the group
* as the student, visit the discussion topic page
* it should redirect to the group subtopic page

closes #CNVS-16143

Change-Id: Iaa611fba37c130bc803a39460c1af0a9021c896d
Reviewed-on: https://gerrit.instructure.com/48210
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-02-06 20:55:08 +00:00
Brad Horrocks c69e8ff120 Fix page load error on Account level group discussions
Group.all_real_students will return all account users when a group's
context is an Account

Fixes CNVS-17623

Test plan

Regression Test
  - Account Level Discussions
  - Group Level Discussions

Change-Id: I0db79ab8285f264d46bce82ddd2a020d894befcd
Reviewed-on: https://gerrit.instructure.com/46974
Reviewed-by: Joel Hough <joel@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Brad Horrocks <bhorrocks@instructure.com>
2015-01-14 15:25:35 +00:00
Matthew Berns 11d95c51b8 resolves group discussion entries not appearing in gradebook and speedgrader
fixes CNVS-17632

test plan:
- create a graded group discussion
- add an entry to the group discussion as a student that is part of that group
- the gradebook should show a submission for that student
- the student's entry should also appear in speedgrader

- go back through test plan from gerrit.instructure.com/#/c/45461
- ensure that test plan still passes

Change-Id: Ib47a9c1299c8fa4083be19a61337dfc26060c36e
Reviewed-on: https://gerrit.instructure.com/46315
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Derek Hansen <dhansen@instructure.com>
2014-12-29 18:20:51 +00:00
Joel Hough 5f8f5d6c7a verify context_code on conversation create api
fixes CNVS-16663
fixes CNVS-16654

test plan
- using the api, create a conversation message with a recipient
 that you are allowed to send to but a context_code for a course
 or group to which you do not belong
- ensure an "invalid context" error is returned

Change-Id: I6eb39f7f50af5bca2065178e469ea9bf21a7b542
Reviewed-on: https://gerrit.instructure.com/45604
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Derek Hansen <dhansen@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2014-12-12 20:22:28 +00:00
Joel Hough 3802b3fd0c respect individual group member limits when randomly assigning
fixes CNVS-16645

test plan
- create a group set
- create two groups
- set one group's membership limit to a low number
- randomly assign enough students to the groups to exceed the limit
 assuming the students were evenly split
- ensure that the group does not get more students than its limit

Change-Id: I680b354f7f54d6a926d67aafb8b10e0fcd6c5a73
Reviewed-on: https://gerrit.instructure.com/45598
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: Derek Hansen <dhansen@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2014-12-11 18:41:43 +00:00
Jacob Fugal 59d28b09bd dup the account chain before mucking with it
fixes CNVS-17308

some callers will want to add stuff to the account chain or otherwise
modify it. some do it in place, which is sad when we return a cached
Array. cache it, but return a copy of the cache, not the cache itself,
to prevent errors from this. Account#account_chain already did this.

particularly, in this ticket, code in RoleOverride.permission_for pushed
siteadmin into the return value from Course#account_chain. this meant
that site admin was already in course.account_chain on the second time
through this code, but the code didn't handle the sharding implications
of that (and shouldn't need to)

test-plan:
  - have multiple shards
  - create a course in an account on a shard that's *not* the same as
    site admin's shard
  - create an AccountMembership role in site admin with permission to
    manage courses
  - create a site admin user with just that role and log in as that user
  - should be able to manage the course in the other shard

Change-Id: Iaf3a19dc2a2c0c7372c82d2af197d9f936792625
Reviewed-on: https://gerrit.instructure.com/45463
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2014-12-09 20:42:22 +00:00
Mark Severson 1a245e6bdd remove non-draft state wiki pages
test plan:
* regression test wiki pages

closes CNVS-16203

Change-Id: Ic37c69c8696151dc99f1df6f3cc9b013835b12a4
Reviewed-on: https://gerrit.instructure.com/42552
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-12-09 20:12:24 +00:00
Joel Hough de71d75283 student leader group management
fixes CNVS-13404

test plan
- as a teacher, create a group with a student group leader
- as the group leader, view the groups page
- ensure that the group has a badge indicating that you are the
 group leader
- ensure a 'Manage' link appears next to the 'Visit' link
- using the 'Manage' link, edit the group name and add/remove users
- ensure that the group is edited
- set a group member limit
- try to add more members than the limit
- ensure that a helpful error is shown when you try to submit
- ensure that trying to submit a group with no name shows a helpful
 error

Change-Id: I5fdf242f21a7f353aaceb20fb75eed2833b197b9
Reviewed-on: https://gerrit.instructure.com/45259
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brad Horrocks <bhorrocks@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2014-12-05 23:47:01 +00:00
James Williams 28e27c6341 allow teachers to seed replies for unpublished and locked topics
test plan:
* as a teacher, should be able to create replies for a topic
 even if it is unpublished or "closed for comments"
 (students should still not be allowed to)
* should be able to unpublish a discussion topic if no
 students have replied to it (instead of if anybody has replied)

closes #CNVS-10384

Change-Id: Ieefebdd3f41709eda6e593d597d08a57c364992d
Reviewed-on: https://gerrit.instructure.com/45048
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Derek Hansen <dhansen@instructure.com>
2014-12-02 19:42:52 +00:00
Jeremy Stanley 96362fd69a data model and API for file usage rights
test plan:
 1. consult the files API documentation and note the additions:
   A. usage_rights include parameter on 'List files'
   B. usage_rights include parameter on 'Get file'
   C. 'List licenses' endpoint
   D. 'Set usage rights' endpoint (PUT)
   E. 'Remove usage rights' endpoint (DELETE)
 2. exercise these new API features

closes CNVS-16826
closes CNVS-16841

Change-Id: I6c01128423adc24a5b70f71bb109d5a005379c37
Reviewed-on: https://gerrit.instructure.com/44403
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2014-11-19 16:14:00 +00:00
Cameron Matheson 2c76c27ad5 sort speedgrader dropdown menu for group assignments
fixes CNVS-16714

Test plan:
  * make some groups with non-latin names (二, and 一, for example)
  * make a group assignment using that group category
  * open the assignment in speedgrader
  * the groups should be listed in proper order (一 before 二)

Change-Id: Ide53cc6a5607fb29907c158325f4698c6d59ff1b
Reviewed-on: https://gerrit.instructure.com/43954
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
2014-11-07 16:00:54 +00:00
Cody Cutrer 102fdfc849 no more dynamic finders (models)
refs CNVS-15126

Change-Id: I2996e0e262c41274c34d0ea3bfde757074416b8c
Reviewed-on: https://gerrit.instructure.com/40973
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-09-24 20:51:48 +00:00
Ethan Vizitei c4765bc2a0 gemify broadcast policy
fixes #CNVS-14270

move broadcast policy into a gem of its own
to remove plugin deprecation warnings.

TEST PLAN:
 -no behavior changes
 -regression test notifications
   (no need to hit them all, confirm that 3 or
   4 separate notifications flow and
    that will prove the pipeline)

Change-Id: If8445653ec09ab4d221124d85f9674d1cedd3751
Reviewed-on: https://gerrit.instructure.com/40899
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Matthew Wheeler <mwheeler@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
QA-Review: August Thornton <august@instructure.com>
2014-09-24 11:35:33 +00:00
Cody Cutrer 44cccdb7d8 normalize account chain usage
refs CNVS-15408

 * add/improve (Course|Account)#account_chain to not have to load
   a single account first, separately (it uses a recursive query to
   load them all at once)
 * change ContextExternalTool.contexts_to_search to use account_chain
   to get the benefits of the recursive query
 * remove #account_chain_ids - it loaded all the accounts anyway, so
   didn't have any optimization, and turns out in all cases it was
   used it either didn't matter, or was actually better to not use it

test plan:
 * use some LTI tools. that should exercise everything changed here

Change-Id: Ie9e89c2566db5c82fb424b41dc21c06be7d0b112
Reviewed-on: https://gerrit.instructure.com/40878
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-09-15 18:19:57 +00:00
Cameron Matheson 7fe73388f5 don't delete memberships when group is deleted
refs CNVS-10184

there is no reason to do this but it makes it impossible to grade group
assignments after the group is deleted

Test plan:
  * make a group assignment
  * make some submissions
  * delete the group category
  * you should still be able to grade the submissions in speedgrader
  * nothing should change from the student's perspective (students
    should *not* see the group anywhere they currently don't see the
    group)

Change-Id: I2c421ea5d88fe77679ddffc60fc3ddb420d33a23
Reviewed-on: https://gerrit.instructure.com/39945
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2014-09-04 00:59:06 +00:00
Jeremy Stanley dc613caf6d zip content exports for course, group, user
test plan:
 1. use the content exports api with export_type=zip
    to export files from courses, groups, and users
   a. confirm only users who have permission to
      download files from these contexts can perform
      the export
   b. confirm that deleted files and folders do not show
      up in the downloaded archive
   c. confirm that students cannot download locked files
      or folders from courses this way
   d. check the progress endpoint and make sure
      it increments sanely
 2. perform selective content exports by passing an array
    of ids in select[folders] and/or select[attachments].
    for example,
      ?select[folders][]=123&select[folders][]=456
      ?select[attachments][]=345
      etc.
   a. any selected files, plus the full contents of any
      selected folders (that the caller has permission
      to see) should be included
      - that means locked files and subfolders should
        be excluded from the archive
   b. if all selected files and folders are descendants
      of the same subfolder X, the export should be named
      "X_export.zip" and all paths inside the zip should be
      relative to it. for example, if you are exporting A/B/1
      and A/C/2, you should get "A_export.zip" containing
      files "B/1" and "C/2".
 3. use the index and show endpoints to list and view
    content exports in courses, groups, and users
   a. confirm students cannot view non-zip course exports
      (such as common cartridge exports)
   b. confirm students cannot view other users' file (zip)
      exports, in course, group, and user context
   c. confirm teachers cannot view other users' file (zip)
      exports, in course, group, and user context
      (but can still view course [cc] exports initiated by
      other teachers)
  4. look at /courses/X/content_exports (web, not API)
   a. confirm teachers see file exports they performed
   b. confirm teachers do not see file exports performed by
      other teachers
   c. confirm teachers see all non-zip course exports
      (cc/qti) including those initiated by other teachers
  5. as a site admin user, perform a zip export of another
     user's files. then, as that other user, go to
     /dashboard/data_exports and confirm that the export
     performed by the site admin user is not shown.

fixes CNVS-12706

Change-Id: Ie9b58e44ac8006a9c9171b3ed23454bf135385b0
Reviewed-on: https://gerrit.instructure.com/34341
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
2014-08-04 16:38:19 +00:00
Jacob Fugal d9c6e2a0cd clarify Slug vs. UUID and fix event stream
refs CNVS-13987

what was called CanvasUuid was *not* generating UUIDs. it was generating
slugs. by default, its generate method only creates 4 character slugs.
these should obviously not be used as UUIDs. the misnomer already caused
a bug in EventStream where it used these slugs as UUIDs, causing
collisions. to fix:

 (1) rename canvas_uuid gem to canvas_slug, and rename it's primary
     class CanvasUuid to CanvasSlug
 (2) create new canvas_uuid gem, with class CanvasUUID, extracted from
     lib/uuid_singleton for actual UUID generation
 (3) fix event stream use CanvasUUID, rather than following the rename
     of CanvasUuid to CanvasSlug

test-plan:
 - have cassandra set up for audit logs
 - create an audit log entry (e.g. change a grade)
 - look at the generated audit log entry's id field; it should be a UUID
   value, not a 4 character slug

Change-Id: I19758fff4433cd6cb2e21219217dced19ee05c5a
Reviewed-on: https://gerrit.instructure.com/37506
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2014-07-11 16:58:42 +00:00
Cody Cutrer 1277aaae90 stabby lambda scopes for rails4
Change-Id: I34f2527471cdb4d8cab5cde426ba959baa26189e
Reviewed-on: https://gerrit.instructure.com/37151
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-07-04 02:11:56 +00:00
Nick Cloward e9595976c1 clean up permission calls for grants_rights?
refs: CNVS-11425

Change-Id: Ia0145e4b4d1da9e0f83a1845647ce203b3586057
Reviewed-on: https://gerrit.instructure.com/34280
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-06-19 18:10:30 +00:00
Nick Cloward e690395a9c increase permissions performance
fixes: CNVS-11425

This is a performance refactor of the permissions.  The
biggest change is the caching.  The cache key is now based
on the right so each right will be cached by itself.  The
goal is to reduce places where we implement caching for
permissions and let adheres_to_policy handle it.

Another commit is coming to clean up calls to the new
methods created here.  g/34280

Test Plan:
  - Make sure permissions all work still.
  - Make masquerading still works with permissions.
  - Make sure switing views such as "student view" for a
    course.

Change-Id: I4a30b0aba394cea24c3b60167fc1369a2584f5a4
Reviewed-on: https://gerrit.instructure.com/34278
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-06-18 22:27:39 +00:00
Drew Bowman 88ff46b0c3 group leaders can edit group name
students who are made group leaders can update
the group name from the group dashboard page

fixes CNVS-11835

test plan:

- make a student a group leader
- visit the group dashboard as the group leader
- change the name as the group leader

Change-Id: I5637f1ef4e423a06f45987e0eccff2e65ac94613
TODO: Add description
Reviewed-on: https://gerrit.instructure.com/35326
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Drew Bowman <dbowman@instructure.com>
2014-05-28 19:52:42 +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
Anthus Williams c247a3758d remove some of the less useful associations from export
delayed_messages, exports, imports, migrations,
stream_items, etc.

Change-Id: I6eb63457ad496d7aaf56fc9ec8a9602a5679fdd7
Reviewed-on: https://gerrit.instructure.com/35215
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-27 15:44:00 +00:00
Ethan Vizitei 3c19c96287 apply dual timezone filters
closes: CNVS-9814

add support throughout our formatting layer
to give us a way to convert values
to the wall clock time of the timezone for
a course (or really any other way we choose),
and then apply that to several selected
date/time displays.

TEST PLAN:

- Login as a user who's part of a course
with at least some data in each tab
- Check the following areas to ensure that
the correct timezone-differentiated hover
text is showing up:
  * Announcements -> Date Sent column
  * Announcement Detail -> Date Sent (top right)
  * Assignments -> Due Date column
  * Assignment Detail -> Due Date (bottom table)
  * Collaborations -> Start Date
  * Discussions -> Last Post Date
  * Discussions -> Due Date
  * Discussion Detail -> Post date of each reply
  * Modules -> (if locked) shows date to unlock
  * Quizzes -> Due Date
  * Syllabus -> Dates on the left
  * Syllabus -> Due dates on the right
  * Settings -> Course Details -> start/end date
  * Settings -> Sections -> start/end date
  * Recent activity page -> Everything

Change-Id: I048c2de85d9f9b196d35c6c65ae104dab7441eee
Reviewed-on: https://gerrit.instructure.com/34861
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Drew Bowman <dbowman@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2014-05-23 19:01:34 +00:00
Ethan Vizitei b68c8fc772 Automatically Assign group leaders
closes: CNVS-11834

This creates a way for an instructor to
assign a random student as the group leader.
It only applies when an instructor is having groups
created automatically at the time of defining
a group category.

This also take an opportunity to refactor out
some bloated code from the group_categories_controller
and move it into some separate objects
that can be more easily understood and rapidly
unit tested through all the necessary permutations
(allowing higher level integration tests to just
cover a case or two)

It ALSO removes group leadership knowledge into
it's own object so that the callbacks in other
objects are simple and the logic regarding
how to do group leadership management is in
one place.

TEST PLAN:

AUTO_DISTRIBUTION:
1) login as an instructor
2) go to the "people" tab and try to create a group
set.
3) click on the "Create [0] groups for me" radio
button; verify you now have controls for assigning
a group leader automatically and that the strategy
radio buttons are greyed out.
4) check the "Assign a group leader automatically"
checkbox; verify the 2 nested radio buttons for
"random" and "first" strategies become enabled
5) select a strategy and fill out the rest of the
form, then submit (make sure your background job
is running)
6) verify after groups are created that each group
has a leader, and that the leader is in fact a member
of the group.

SelfSignup:
1) login as an instructor
2) go to the "people" tab and try to create a group
set.
3) enable self-signup.
4) check the "Assign a group leader automatically"
checkbox; verify the 2 nested radio buttons for
"random" and "first" strategies become enabled
5) select a strategy and fill out the rest of the
form, then submit.
6) Login as a student for the same course and join
the group.
7) verify that the student has been made the group
leader.

Change-Id: I2cdd9f5ed2fd577469beec4ab7369c69ecf7eaa6
Reviewed-on: https://gerrit.instructure.com/35130
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2014-05-23 17:23:53 +00:00
Joel Hough 0d186e3c1a group leaders
fixes CNVS-11833

test plan
- regression test teacher view of groups page

a group can only have one group leader, and that user must be in
the group. anything that can be done to remove a user from a
group should revoke their leadership if they have it. a user's
leadership should not be revoked unless the teacher revokes it,
a different leader is chosen, or that user leaves the group. a
leader's user should have a user icon on it and their name should
appear next to the group's name

a few test cases:
- set group leader using gear menu on user in group
- revoke the leadership of the user using the gear menu
- ensure that the group is now leaderless

- set a group leader
- set a different user as leader
- ensure that a screenreader identifies the group leader link as "Group
  Leader"
- ensure that the first user is no longer the leader

- set a group leader
- remove that user from the group by dragging and dropping
- ensure that the user is no longer the group leader

- set a group leader
- move the user to another group using the option on the gear
 menu
- ensure that the user is not the leader of their original or new
 group

- in a large-roster course, add users to a group user the plus
 button next to the gear menu
- set a group leader using the gear menu next to a user
- fill a group up to it's maximum limit of students
- ensure that the "full" label shows up for that group
- ensure that when you narrow the browser size, you can
still tell that the group is full

Change-Id: I8bb1b62e0f36a37a24e050878c945f822fe9f66c
Reviewed-on: https://gerrit.instructure.com/34360
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2014-05-20 22:22:12 +00:00
Drew Bowman 0d42fd2204 allow users to manage group membership limits
fixes CNVS-11830
fixes CNVS-11831

test plan

 - add a course group
 - set the max members in the group creation dialog
 - verify that the limit is enforced

 - enforced it a course group
 - change the max members in the group edit dialog
 - verify that the new limit is enforced

 - edit the group set
 - change the max members limit for the group set
 - verify that the limit is changed for all of the groups in the set

Change-Id: I6f112d29d6c5ca662da1598e29db2f3081f30148
Reviewed-on: https://gerrit.instructure.com/33722
Reviewed-by: Joel Hough <joel@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Drew Bowman <dbowman@instructure.com>
2014-05-09 16:49:47 +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
James Williams 7692af009a move all importing methods into models/importers
test plan:
* migration regressions

Change-Id: Ibed8d4820c05b9c69101b215932af32055c3e006
Reviewed-on: https://gerrit.instructure.com/33728
QA-Review: Clare Strong <clare@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-05-02 17:31:15 +00:00
Jeremy Stanley f84003358f allow zip file import migrations on users and groups
test plan:
 - use the List Migration Systems endpoint on
   a group and a user, and confirm only the
   zip_file_importer is returned
 - use the Content Migrations API to import a zip file
   into folders belonging to Users and Groups
   - try both the POST and the URL workflows
   - ensure migration types other than zip_file_importer
     are rejected in User and Group context

fixes CNVS-11218

Change-Id: I4b407ce76f0b5df60cc9f99795a6d9d3ddf81ae2
Reviewed-on: https://gerrit.instructure.com/33723
QA-Review: Clare Strong <clare@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2014-05-01 15:18:42 +00:00
Cody Cutrer 4c02840494 optimize permission checks for groups in SearchHelper
fixes CNVS-11231

Change-Id: Ic48d019e43add3498535d3fde84d3dfebc0e734f
Reviewed-on: https://gerrit.instructure.com/31048
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-02-28 22:10:58 +00:00
Raphael Weiner 644b29d12f extract auto_handle to new canvas_uuid gem
Change-Id: Ic226e61e900532cc3acf08444b316b6e2bb6b368
Reviewed-on: https://gerrit.instructure.com/30049
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-02-25 19:30:59 +00:00
Cameron Matheson 3c434e8aff Remove unused collections stuff
This was a beta api that didn't work out.

Test plan:
  canvas should still work (sorry, this touches lots of stuff)

Change-Id: I31680b83f72f6d739ce74735ba40d7a760debb33
Reviewed-on: https://gerrit.instructure.com/29506
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2014-02-07 19:32:46 +00:00
Mark Severson 0152fa52fa deprecate hide_from_students on wiki pages
hide_from_students is being deprecated in lieu of the workflow states
'active' (published) and 'unpublished'

test plan: (draft state and legacy)
  special attention should be given to areas related to hiding wiki
  pages from students (legacy: hide from students checkbox;
  draft state: published/unpublished items)

  items that are hidden from students or unpublished should show for
  teachers, but should not show for students

 - areas to test:
   - pages api and ui (regression)
     - validate hide_from_students and published values in all api calls
   - course migrations (specifically course copy)
   - wiki sidebar in other parts of canvas

fixes CNVS-10354, CNVS-10366

Change-Id: I70f4d8c07c2be4150163279f0673377bad6e9c48
Reviewed-on: https://gerrit.instructure.com/28375
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2014-01-15 21:29:06 +00:00
Jon Jensen e05dde3827 show uncategorized account groups, fixes CNVS-10188, refs CNVS-1482
when you import groups into an account vis SIS, they are not linked to any
group set. this commit puts them in a new "Uncategorized" tab so you can
still see them and navigate to their home pages. previously you could see
them in the now-retired right sidebar.

note that there is no "Uncategorized" set in the db; we simply display a
synthetic group set that is essentially read-only.

also note that this doesn't apply to course groups, because 1. you can't
SIS import them and 2. canvas won't let you create a course group without
a group set.

test plan:
1.  do a SIS of import of some groups. for bonus points, import some users
    into those groups
2.  go to the manage groups page for the account
3.  you should see an "Uncategorized" tab at the end (always comes last)
4.  click it
5.  you should see a note explaining what these are
6.  you should not be able to delete or edit the group set
7.  you should not be able to add/edit/delete groups in the set
8.  you should be able to see the users in the groups (if any)
9.  you should not be able to reassign users (via menu or drag-and-drop)
    in the group set
10. you should be able to navigate to a given group's home page (via cog)
11. you should be able to filter groups via the search box
12. accounts without Uncategorized group sets should not have an
    Uncategorized tab
13. all other group sets (and their contents) should behave normally in
    this account and in any other course/account (general regression test)

Change-Id: Id0fa8e547bc9274a685c89d70b0cbb54ef3a01d0
Reviewed-on: https://gerrit.instructure.com/27933
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
2013-12-30 20:30:35 +00:00
Zach Pendleton f5ee7dbfc3 remove tinychat code
fixes CNVS-10058

canvas no longer integrates with tinychat; this commit
removes legacy references to it.

test plan:
  * run specs

Change-Id: I4887e901d57ff39f8554af3e4eacd52ec4edd6e5
Reviewed-on: https://gerrit.instructure.com/27621
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
2013-12-18 22:51:45 +00:00
Landon Wilkins ee58627c64 optimize random group assignment
fixes CNVS-9457

test plan:
* regression testing of random group assignment
* verify that the assignment is much faster

Change-Id: Icfc72f6041f6367e43561d8b8240e6a2ffde4801
Reviewed-on: https://gerrit.instructure.com/26568
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-12-13 22:30:48 +00:00
Jeremy Stanley dcf3df456b move draft state under feature flag umbrella
fixes CNVS-9496

test plan:
 - draft state feature should show up in site admin feature
   flags, or root account feature flags when called as site
   admin
 - when site admin hits "allow" for the feature, it should
   appear in the root account administrator's settings
   in "Off" state
 - the root account admin should be able to "Allow" the setting
   which allows a sub-account or course to turn it on
 - when the feature is turned on via the Feature Settings tab
   or features API, draft state functionality should appear
   in the course wiki pages and elsewhere

Change-Id: Id7403f2a8371b0a7bfebffbb8f29330fff5c94c5
Reviewed-on: https://gerrit.instructure.com/26308
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
2013-11-26 20:43:49 +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
Mark Ericksen ba9454538b don't auto-add teacher to created student group
fixes CNVS-9335

testing notes:
- as a teacher (with no student enrollment in the course),
  create a new group under the "Student Groups" category/set.
- the teacher should not be added to the newly created group
- a student creating a new group should be
  auto-added as a member

Change-Id: I8840cc38c612eda105cd1c86fbce1e40a7f81063
Reviewed-on: https://gerrit.instructure.com/26076
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-11-08 19:46:51 +00:00
Rob Orton 9cae25c185 record when a quiz or user gets deleted
also force deleted_at to be utc

test plan
 - delete a user
 - the user should have deleted_at populated
 - delete a quiz
 - the quiz should have deleted_at populated

Change-Id: Ibf3442b832f648d754ac9959f053570bc8c06a19
Reviewed-on: https://gerrit.instructure.com/25585
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2013-10-29 23:07:12 +00:00